1

I want to separate an html page into head, header, footer sort of stuff like that. And include them as I create a new page so that I won't have to update all pages if I change something in header or other parts of the included ones.

The problem is that I can do that easily with php support but the current server nginx(actually I don't really know what that means as a front-end dev) doesn't have that and won't do in the future. How can I accomplish that with pure html or with a little help of nginx?

Liang
  • 1,127
  • 2
  • 11
  • 22

2 Answers2

1

You could use javascript includes.

For example if you were using jQuery…

page1.html

<div id="head"></div>
<script src="head.js"></script>

head.js

$('#head').html('<html goes here>');
c01gat3
  • 597
  • 3
  • 18
  • By head, I mean something like "" which has js files like jquery included if jquery is not included in the html in the first place, then how could the head.js even work? I have to say this is not an elegant approach. – Liang Jun 24 '15 at 06:31
0

If you don’t mind compiling before uploading you could use .kit files. https://incident57.com/codekit/help.html#kit

And it’s not just for mac users… Compile .kit files outside of Codekit

Community
  • 1
  • 1
c01gat3
  • 597
  • 3
  • 18