Is there a way to import a block of HTML into a file without the use of something like PHP or Javascript? For my personal website, any time I make a small change to the content of my navbar, I have to go to all of my other pages and make that same change.
2 Answers
Do an internet search for "Server Side Includes for HTML"
Here's a good start: http://en.wikipedia.org/wiki/Server_Side_Includes
Example:
<!--#include virtual="header.html" -->
3 Comments
selbie
Not sure why this just got a down vote. SSI is exactly what the OP was asking for.
selbie
@Charlie - SSI works just fine on any HTML page. And most all web servers that I know of support it. It does not require PHP.
Charlie
My mistake :) I always thought this was PHP specific, but I'm wrong. Good to know.
No feature like the one you described is in the HTML spec, but if you don't have access to server configurations and the like, you can write your code in a language like HAML and compile it, which would accomplish what you described without any server-side work.