devxlogo

Including Boilerplate Text

Including Boilerplate Text

If you have header or footer material which appears on every page in your site, such as navigation or copyright information, it makes sense to store it centrally and use server-side includes to make it appear where needed. That way, if you change anything, you only have to change it once for it to show up everywhere.

If you have header material in a file called header.html, you can include it in a page like so:

 ...

If the include files are stored in their own directory, you’ll need slightly different syntax:

 

For any of this code to work, you’ll need to make sure that your server is configured to parse HTML pages. Pages with server-side includes usually have the .shtml extension, to let the server know they should be parsed. It’s possible to configure your server to parse all HTML files, but that will slow everything down considerably.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist