logoalt Hacker News

em-beetoday at 7:34 AM3 repliesview on HN

i have a static website with a menu. keeping the menu synchronized over the half dozen pages is a pain.

my only option to fix this are javascript, xslt or a server side html generator. (and before you ask, static site generators are no better, they just make the generation part manual instead of automatic.)

i don't actually care if the site is static. i only care that maintenance is simple.

build tools are not simple. they tend to suffer from bitrot because they are not bundled with the hosting of the site or the site content.

server side html generators (aka content management systems, etc.) are large and tie me to a particular platform.

frontend frameworks by default require a build step and of course need javascript in the browser. some frameworks can be included without build tools, and that's better, but also overkill for large sites. and of course then you are tied to the framework.

another option is writing custom javascript code to include an html snippet from another file.

or maybe i can try to rig include with xslt. will that shut up the people who want to view my site without javascript?

at some point there was discussion for html include, but it has been dropped. why?


Replies

bambaxtoday at 10:33 AM

> i have a static website with a menu. keeping the menu synchronized over the half dozen pages is a pain

You can totally do that with PHP? It can find all the pages, generate the menu, transform markdown to html for the current page, all on the fly in one go, and it feels instantaneous. If you experience some level of traffic you can put a CDN in front but usually it's not even necessary.

show 1 reply
rsolvatoday at 8:35 AM

I recently tried building a website using Server Side Includes (SSI) with apache/nginx to make templates for the head, header and footer. Then I found myself missing the way Hugo does things, using a base template and injecting the content into the base template instead.

This was easy do achieve with PHP with a super minimal setup, so I thought, why not? Still no build steps!

PHP is quite ubiquitous and stable these days so it is practically equivalent to making a static site. Just a few sprinkles of dynamism to avoid repeting HTML all over the place.

rossanttoday at 11:11 AM

Frames. Use frames. They're the future. Definitely.

show 1 reply