How To Include An External Html-head?
Solution 1:
I prefer PHP. Change your .html (static) pages into .php (dynamic) pages. Just 'save as'. You can separate pretty much anything into templates.
You have the following simplified file structure:
index.phpheader.php
home.phpfooter.php
style.cssThe index.php contains + calls the header.php + home.php + footer.php
The header.php has your menus, etc.
the home.php can have your slider, and more sections, etc.
the footer.php has your menus + copyright, etc.
the style.css has your styles and you can have many .css files depending what you want styled.
You can expand this to your other pages: about.php, services.php, contact.php, etc.
Into index.php file you add something like
<?phprequire ('your-folder-for-content/header.php'); ?><?phprequire ('your-folder-for-content/home.php'); ?><?phprequire ('your-folder-for-content/footer.php'); ?>Close </html> bracket at the end of your footer.
One page or little repeated sections call the other and redundancy is prevented.
Solution 2:
You can't do this with client JavaScript coz it running after header parsing. You should use server side technologies for this. From SSI to PHP :)
Solution 3:
Jekyll is pretty good and easy to use. You can strip off all the features you don't need. Has template filling available as well. It outputs static html for the whole site, so you don't need your server to be running any daemons.
Post a Comment for "How To Include An External Html-head?"