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.
Asked
Active
Viewed 232 times
-1
-
There is...and it depends (somewhat) on you language. – Chris Catignani Oct 08 '19 at 13:08
-
Possible duplicate of [Include another HTML file in a HTML file](https://stackoverflow.com/questions/8988855/include-another-html-file-in-a-html-file) – karthik_varma_k Oct 08 '19 at 13:12
1 Answers
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