Technology
This is the official technology community of Lemmy.ml for all news related to creation and use of technology, and to facilitate civil, meaningful discussion around it.
Ask in DM before posting product reviews or ads. All such posts otherwise are subject to removal.
Rules:
1: All Lemmy rules apply
2: Do not post low effort posts
3: NEVER post naziped*gore stuff
4: Always post article URLs or their archived version URLs as sources, NOT screenshots. Help the blind users.
5: personal rants of Big Tech CEOs like Elon Musk are unwelcome (does not include posts about their companies affecting wide range of people)
6: no advertisement posts unless verified as legitimate and non-exploitative/non-consumerist
7: crypto related posts, unless essential, are disallowed
view the rest of the comments
It's not an only html solution, but I'm fond of using nginx server side v includes, which with a little setup let's you do things
You can do simple things like set variables and import reusable html templates. And since nginx is commonly used as the webserver or proxy you kind of get this functionality "for free."
PS generating html by hand isn't that bad though. You can either script it yourself or just have your own manual template html file that you base everything on, and/or use something like emmet/emmet-vim
That nginx thing looks pretty cool! Very neat (if using nginx).
In the second half you're talking about dynamic imports right? Like
fetching the html with JS and then loading that? I try and avoid doing that for various reasonsI think I get you? No JS involved, no dynamic requests from the client side. Opening the page in a browser, you'd just see the one page request which arrives fully formed looking like static html.
If you mean my scripting and emmet comment, I just meant to script the creation of the static html then serving it. But not like programmatically, more like
for file in ./blogs/$(date -I).*/*; do cat $file >> ./blogs/$(date -I).serve-me.html; doneor something (probably more rigorous than that, but that kind of mix of convention is semi automated hackery). I find non-commercial web pages don't really need to change very much, so I'll often just copy a header and footer into a file and fill in the middle manually. But I actually enjoy writing HTML. :9I also try to avoid JS unless there's something I really want to do with it. And then I like to offer a alternative.