3 ms·
Genuinely curious, what kind of Crazy Stuff do you need for a static site generator? It strikes me as one of those technologies I want to be as boring as possib
by fbdab103 3y ago
Genuinely curious, what kind of Crazy Stuff do you need for a static site generator? It strikes me as one of those technologies I want to be as boring as possible. I never want to debug why my content is not being rendered.
- arp242 3y agoIf you want "as boring as possible" and "never want to debug" then you probably shouldn't be using Jekyll in the first place; for simple boring use cases all you need is: for f in ./posts/*.md; do dst=site/$f:r.html cat head.html >$dst markdown $f >>$dst cat footer.html >>$dst done Or some variant of that, in your preferred language. There's loads of things you can do wrong in Jekyll even without any plugins, and this applies to most static site generators. Anyway, I have a list of plugins at [1]; some are as simple as "don't use leading 0 for dates but a space" so it looks nicer (IMHO) but still aligns well, and others are a bit more crazy such as "use Vim's :TOhtml for syntax highlighting because I think Rouge looks horrible". Stuff like "show all posts with the same tag as the current post" could be done in pure Liquid template too, but this is usually a lot more awkward and a lot slower, and convenience tags like {% warning %}Watch out!{% endwarning %} are completely unnecessary as such, but it's just convenient and nice. [1]: https://github.com/arp242/arp242.net/tree/master/_plugins https://github.com/arp242/arp242.net/tree/master/_plugins
- 38 3y ago> dst=site/$f:r.html Colon is not a portable character for a file name.
- darrenf 3y agoI'm gonna say the example code is in zsh, where `$foo:r` means "remove the extension from $foo". See the `r` entry here: https://zsh.sourceforge.io/Doc/Release/Expansion.html#Modifiers https://zsh.sourceforge.io/Doc/Release/Expansion.html#Modifi... % foo=foo.md % echo $foo:r foo
- 38 3y agoProbably not a good idea to post code using random shells when giving examples. User should specify zsh, or just use posix.
- arp242 3y agoIt's just an illustrative example that I didn't even bother to check for syntax errors, and I'm just used to zsh syntax so I don't always remember to translate to POSIX, and quite frankly, it doesn't matter because no one will or should run this script, because it's just illustrative, which is obvious to anyone. You're making a big deal out of nothing.
- 38 3y ago> Typically this term refers to a rhetorical strategy where the speaker attacks the character, motive, or some other attribute of the person making an argument rather than attacking the substance of the argument itself. https://wikipedia.org/wiki/Ad_hominem https://wikipedia.org/wiki/Ad_hominem
- lelanthran 3y agoMy blog actually is a shell script that runs pandoc. For a blog, anything more is overkill.
- mjlee 3y agoWhat shell are you using here? In bash, I would run something like: for f in ./posts/*.md; do dst=site/${f%.md}.html cat head.html >$dst markdown $f >>$dst cat footer.html >>$dst done
- zkldi 3y agoboth of these scripts break on perfectly valid filenames with whitespace, it's pretty rough how shell scripting directs you towards writing subtly broken scripts.
- arp242 3y agoIt's not broken in zsh.
- KolenCh 3y agoPerfectly valid file names in your case can be quite poor choice of names in the context of generating static site. And even if the code could be perfectly runnable, I expect them to be pseudo-code here to illustrate a point, not to ask people to run it.
- arp242 3y agoOops, the :r to remove the extension is zsh; I'm so used to writing scripts in it I sometimes forget translating it to sh/bash (should also quote the variables in (ba)?sh).
- amedvednikov 3y agoThat's a nice shell script! Probably enough for 90% of static sites.
- oliwarner 3y agoCustomised markdown snippets, various semi-dynamic data fetching and preprocessing (eg churning a database into JSON for a front-end), chunking MPA bundles based on the pages, etc etc etc. Ways to [ab]use SSGs to fulfill your twisted whims are legion.