zettelkasten permalinks

#meta #zettelkasten

Following on from my last post about Zettelkasten IDs I thought "why not implement this for permalinks that don't need pre-processing?" In other words, a permalink callback script. Less efficient, as it's dynamic, but it does provide a proper permalink that can be used outside of the site. (Of course the best thing is just not to change the URL but, you know. Anyway this is more of a toy.)

So I added a little PHP script at /z.php which takes an id parameter. As part of the build process, a JSON file is now generated containing a map of the Zettel IDs to their paths. If the id parameter parses as an appropriate Zettel ID, the PHP script reads this lookup table, and if the ID is in there, you get the page, otherwise you get a 404.

For instance this page has Zettel ID 202202271739 - going to /zettel.php?id=202202271739 should take you right back here. /zettel.php?id=not-an-id-actually won't.

I could use this to do all of the Zettel ID links without needing them processed at build time, but as mentioned above, this isn't the most efficient way of doing things, so probably not.

Email is not publicly displayed