4 ms·
The big upshot of Jekyll for me is that I can use Ruby plugins, and that Ruby allows me to do Crazy Stuff™ with monkey-patching. This means I both have a "works
by arp242 3y ago
The big upshot of Jekyll for me is that I can use Ruby plugins, and that Ruby allows me to do Crazy Stuff™ with monkey-patching. This means I both have a "works out of the box experience", but that I can also tweak and customize anything I want, or add new features in an "ad hoc" fashion when I need them – it's the best of both.
This isn't possible with Go, because it's just not that kind of language; it's more or less impossible to have a plugin system similar to Jekyll.
My dayjob is to write Go code and has been for almost 8 years, I think Go is a great language. But I don't think the language is a great fit for this kind of thing.
- fbdab103 3y agoGenuinely 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.
- 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.
- Thaxll 3y agoHugo is one of the most popular static site generator and it's written in Go, most people don't need to extend it.
- Simran-B 3y agoI second that the hackability of using a tool written in an interpreted language is a huge advantage, but Jekyll can be darn slow and with Hugo (written in Go), the need for plugins is actually quite low in my experience - thanks to "shortcodes", Go templating, and render hooks. If you want to customize the Markdown parser or similar, it requires to change the Go code and compile everything yourself, which is not great especially from a maintenance perspective. But I wonder, would it be possible to add more extension points and then only compile plugins written in Go instead of the full source code of the tool plus your modifications? IIRC, Go does support something akin to shared libraries but not cross-platform.
- doctor_eval 3y agoThere is always https://github.com/traefik/yaegi https://github.com/traefik/yaegi - a Go interpreter written to make it easy to write plugins.