-1

I am making a local website where I have a number of pages with a lot of common code for header, navigation bar and footer. I was wondering if there was a way I could use to store the header, footer and other such codes as independent html files, and then simply link them in the code for the new page.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Martin Medro
  • 137
  • 9

1 Answers1

1

You can use server-side includes for using an HTML file into another one. For that, you'll have to make a few changes in your server configuration as well. I'll show you an example of Apache.

Change configuration as mentioned in https://www.linuxtopia.org/HowToGuides/apache_ssi.html

Include the below code in your html file and replace "included.html" with your section html filename

<!--#include file="included.html" -->

Check more on : https://en.wikipedia.org/wiki/Server_Side_Includes

Niraj
  • 386
  • 1
  • 8