Pinjasaur / bic

Static blog generator, in bash
https://bic.sh/
10 stars 1 forks source link

replace hashids (bashids) with sqids #20

Closed Pinjasaur closed 1 month ago

Pinjasaur commented 1 month ago

https://sqids.org/bash

this'll be a breaking change because the IDs (used in the RSS feed) will change, but it'll also simply it all slightly by removing the SALT envar

mfossen commented 1 month ago

Will this cause any issues (dupes etc.) to be sent via RSS after the change?

Pinjasaur commented 1 month ago

yeah, it will cause dupes. I ended up ripping the bandaid off and doing this on my own a blog a couple years back: https://paul.af/breaking-rss-feed-changes

it's used like this right now: https://github.com/Pinjasaur/bic-example/blob/e4ef0ef54f175c4abc05e74f81e93277f49dc148/__feed.rss#L4-L5

here's the spec for guid: https://www.rssboard.org/rss-draft-1#element-channel-item-guid

here's the current implementation of mk_id as part of bic's internals: https://github.com/Pinjasaur/bic/blob/5ebb85420d9addceb9ddbad0cb7d6f051ed269e1/bic#L106-L114

it's imperfect, but I was intentional about doing it this way to still allow for changing the filename e.g. 000-foo.md -> 000-bar.md will go from /foo to /bar but will retain the same underlying id which will prevent dupes

I don't have a better idea on handling it offhand. thoughts @mfossen?

Pinjasaur commented 1 month ago

technically, could go with the bare number prefix e.g. 000 from 000-foo.md but wanted to make it more ID-like by using a library like hashids/sqids. there definitely won't be a 100% perfect solution, but I do like this overall: I've been bitten by renaming the files of already-published entries which unfortunately changed the underlying GUID for the RSS feed