Replacing my Octopress blog with 200 lines of Babashka
blog.michielborkent.nl
blog.michielborkent.nl
For me, the posts underlines the argument that you’ll feel better if you stick to the tools or languages you know.
The $RET$ hack smells weird. Can you join the lines before flushing it down the markdown renderer?
Perhaps I woke up in the wrong mood, but I’d have praised the authors and community of the tool, it’s open-source, was built with generosity out of one’s own free time. That’s quite a capital!
So, we all know stuff gets abandoned, people do move on, perhaps they could handle handovers or sunsetting better, but let’s be first of all grateful.
For posterity, here is the passage:
> I started using Octopress back then and was still using it until today. In recent years I became frustrated with it since on every new system I had to install a version of Ruby that happened to work with Octopress, which wasn't always the case. When it did work, I started getting deprecation warnings from Ruby while compiling this blog. On top of this, Octopress seemed no longer maintained. The website says "Octopress 3.0 is Coming" but this announcement was from 2015 and the website hasn't been updated ever since. It felt like time to move on.
Octopress worked great for my blogging purposes and I'm grateful that it existed. However, in recent years I became frustrated with the experience of using it, which is probably due to a lack of my familiarity with the Ruby ecosystem.
Unfortunately this didn't work since it would also join lines in code snippets that contained []'s. This is a basic hack that prevented me from writing a more sophisticated markdown parser.
Considering you now have at least one input file where this sequence does appear organically (i.e. this blog post), I'm also curious how your setup is handling this correctly instead of mangling the content. What am I missing?
Part of blogging in markdown files is universal portability: you can use any editor, parser, doc publisher, or site generator on a set of generic plaintext files. Those headers were “YAML Front Matter” standard metadata, and for portability belong in the file not elsewhere.
This is used across pandoc, static site gens, Markdown parsers, and Markdown editors (VSCode, Sublime, Bear, Ulysses, Obsidian, Typora, etc.).
https://jekyllrb.com/docs/front-matter/
https://forestry.io/docs/editing/front-matter/
https://assemble.io/docs/YAML-front-matter.html
https://blog.valeconsulting.co.uk/2019/09/05/automating-docu...
https://docs.zettlr.com/en/core/yaml-frontmatter/
And finally, Clojure library designed to parse front matter:
And there is nothing wrong with inversing the control of the metadata. Instead of having each file carrying the metadata and you need to iterate filenames to get the full list, it's OK to have a index that has the filenames to read + the metadata. Simply a matter of preference and not really a requirement for someone to say that they "blog in markdown files", whatever that means.
It's not simply a matter of preference. While front matter isn't a part of the Commonmark spec, it is very well adopted to the point where it's effectively universal across blogging apps and static site generators. You can move a markdown file from Hugo to 11ty to Gatsby to Hexo to Jekyll without changing or losing any of the content and they'll all understand your title, slug, posting date, labels, etc without any configuration or code changes necessary.
You lose that by doing something different even if you prefer an alternative approach. That's something to consider if you choose to go against the grain. It affects more than just preference.
Personally the biggest advantage I see of front matter is that it encapsulates everything about a post in one place. I don't need to update an index if I delete a post, or add one, or something.
That said, writing a script to take the index content and insert it in to the post markdown files as front matter wouldn't be very hard, just as it'd be very simple to extract front matter to your own index file, so it's not really a big deal however you choose to do things.
But this particular design decision, which works well for the author, is worth flagging for others as it bumps against a variety of first principles in Unix and Lisp such as simplicity, composability, and interop/portability apart from tools.
For example, from your comment:
> Instead of … filenames … have an index [of] filenames to read + the metadata
And now you have to sync an index of metadata on top of the existing index and files. If you interact with the files through any other tool, you can have files not in the index, or index w/o files…
Plenty use cases depend on that. Here’s a user asking about inability to independently edit files with Joplin:
https://discourse.joplinapp.org/t/yaml-front-matter-metadata...
But here we already have an index, the directory tree, that already contains the critical metadata: name, created/modified dates, sufficient to retrieve the media and the media specific metadata. Can even natively leverage tags if we use file tag metadata natively supported in some filesystems, then the OS GUI and other apps can search and retrieve w/o extra moving parts, and still read custom metadata from the media (in this case plaintext markdown article) itself.
Also, most “bog standard” markdown editors have, by now, a toggle to pretty print or table-ize frontmatter, and suppress it on publish (especially since many leverage pandoc which supports that). When they don’t, it’s just three dashes and some TOML, works fine as text.
Put another way, YAML Front Matter is to plaintext .MD articles as ID3 tags are to MP3, AIFF, AIF, M4A, M4R, FLAC, OGG, WAV, APE, ASF, and WMA audio files.
TL;DR:
Even if you maintain a separate index, you still want to write back the metadata into the media file standard so the media outlasts the media management tool.
What is the priority - being able to switch blog implementations at the drop of a hat, or having an actually good website?
Also, Hugo/Golang has it's own templating and really, who wants to deal with templating in 2021? XML/HTML as data (like Hiccup does) is so much easier and flexible.
Some things I would like to see in Pelican are:
- Better documentation in the code. The documentation for the final user is great. However, if you inspect the code, it will take some time to understand it since many functions are not documented. Compared to other code bases, like Keras, the docstrings can help the developer.
- More themes. The default theme is not my favorite. Also, I think Jekyll and Hugo have better themes.
(It is not a critic. I love Pelican)