4 ms·
Repeating the headers and footers even eight times seems unworkable to me. I'm quite certain I'd mess up at some point, and one page would be different from all
by jarrett 12y ago
Repeating the headers and footers even eight times seems unworkable to me. I'm quite certain I'd mess up at some point, and one page would be different from all the others. Maybe there are some projects where that doesn't matter, but I haven't worked on such a project.
For me, a static site generator is the bare minimum.
- toyg 12y agoSSI is usually available out of the box, or at worst an .htaccess away.
- X-Istence 12y agonginx certainly doesn't use .htaccess ...
- btgeekboy 12y agoOr, on your basic shared hosting, you'll usually find PHP too. While I'm not advocating a ton of calls to do all sorts of things with databases and who knows what else, a set of PHP includes (and maybe a few additional helper functions) would be similarly useful.
- NateDad 12y agoThe thing of it is, the next person that looks at the site might not know PHP... then what? You must know HTML to be able to work with a webpage. Anything else is just a further restriction on who can edit the site. Most small businesses get their websites managed by whoever happens to come along with a tiny bit of knowledge. The tiny bit of copy and paste you might need to do to avoid non-HTML is a perfectly good tradeoff to keep the barrier of entry as low as possible for the next poor schmuck who has to go in there and twiddle with things.
- ahallock 12y agoA PHP include takes about 1 minute to explain. You don't even need to know PHP, just the include syntax.
- stevekemp 12y agoThe downside there is performance overhead. If a user requests "/foo/bar/baz" you have to allow your webserver to stat "/foo/bar/baz/.htaccess", "/foo/bar/.htaccess", and "/foo/.htaccess" which can be a significant performance hit. SSIs have similar issues, parsing all files on the off-chance there is some magic that will be required.
- mixmastamyk 12y agomake (or a simpler alternative) is also an option in such circumstances.
- jarrett 12y agoHow so? Would you use basic Unix utils like `cat` to build the final page? I guess you're essentially building a static site generator at that point. Albeit a very simple one with minimal dependencies.
- mixmastamyk 12y agoRight, you have a header, a collection of body docs, and a footer. A markdown converter if you'd like. make and then scp transfer or commit to vcs, etc. As these are common tools there's no cognitive overhead for developers and it can still be automated for users.
- jarrett 12y agoYep! That's a great solution for a lot of sites.
- wvenable 12y agoMy personal site is static but using minimal PHP to include headers and footers. I had intended to use a content management system at some point but never got around to it.
- NateDad 12y agoReally? You can't copy and paste 8 times and then visually verify each one? Hell, you could diff them against each other to make sure you're not missing anything in those sections. I think our culture has put too much of a taboo on copy and paste. It's not the end of the world if you're careful about it. Ideally, yes, you'd have it defined in a single template which then assures you that all pages are identical.... but what happens when the next guy comes and doesn't understand how the templating system works? It may end up costing your client a lot more money because the guy has to spend time figuring out your specific brand of templating, making sure he has the tools to work with it, etc etc. As opposed to simple copy and paste in plaintext, no tools, just content.
- wtetzner 12y agoThat's why you use a static site generator. If the next guy wants to just edit the output of the static site generator, he can, and you're no worse off than if you'd just written it by hand in the first place.