4 ms·
Depends on how many times you repeat yourself. A dozen of times? Sure. A hundred times? I don't think so. You can write a program that programmatically replaces
by runald 6y ago
Depends on how many times you repeat yourself. A dozen of times? Sure. A hundred times? I don't think so. You can write a program that programmatically replaces the footer and header, provided that the content and layout is properly separated. But at that point, you might as well just have a build tool, and have your content and layout decoupled in the first place.
Fair point, lots of people never actually go past ten or more blog posts. Still, even a simple build tool in bash works better.
- forrestthewoods 6y ago> at that point, you might as well just have a build tool, and have your content and layout decoupled in the first place Maybe. One of the (many) problems with static generators is that it's really really really hard to get it to generate the code you want. It's easy to get it 95% of the way there. But that last 5%? It's brutal, and sometimes impossible. A tool automatically does 95% and can be manually finished is very different from a tool that must do everything 100%. A good rule of thumb would be "use wordpress until you hit 50 posts". At that point decide what makes sense for your content. And at this point you should know what you want, so any choice you make is likely to stick. I don't recommend handcrafted HTML for most people. But I do think more folks should at least consider it. For my content it both gives more control AND saves me time. Even if I have to do a little grunt work every once in a blue moon.
- runald 6y agoYou don't need even a static generator really, even just cat header.html page1.html footer.html > build/page1.html would work
- hu3 6y agoThis is such a simple yet powerful idea I don't know how could I not think of that before. Thanks. 'cat' will be my static site generator.
- Kye 6y agoI put together something like this with PHP, like how I did websites in ancient times with SSI[1], but it output a static site. It never occurred to me I could just cat them. I could even still use PHP or any language to generate some components and just cat the output with the others into one file. That would help people who prefer to write in markdown. Just run it through a markdown->HTML converter and output it to a file with header and footer included. [1] https://en.wikipedia.org/wiki/Server_Side_Includes https://en.wikipedia.org/wiki/Server_Side_Includes