borkdude / quickblog

Light-weight static blog engine for Clojure and babashka
https://blog.michielborkent.nl/
MIT License
165 stars 28 forks source link

Enables custom default tags and ability to add no tags (issue #51) #52

Closed formsandlines closed 1 year ago

formsandlines commented 1 year ago

The default tag will still remain "clojure", but users can change it by adding :default-metadata {:tags […]} to their opts map in bb.edn, which also enables them to add multiple default tags or none at all (with an empty vector). I hope my changes are aligned with the intended use of :default-metadata.

For a single post, users can just add --tags without any arguments to omit tags even if the default vector is not empty. Maybe there could also be an option --no-tags for clarity of intent, but I don’t think it’s necessary.

borkdude commented 1 year ago

I should enable a test runner on CI, but for now you can run tests locally with bb test. If possible, it would be good to add a test for this PR as well.

formsandlines commented 1 year ago

Oh well, seems like the test for migrate fails, because tags are now ordered before the post title in the document after calling api/migrate. I don’t know what causes this, but I’ll see if I can fix it.

I only tested the behavior of the new command with various tags/defaults in a separate project, but will try to add tests as well, if I can figure out how to set them up correctly.

borkdude commented 1 year ago

I think you can change the test by splitting the lines and comparing the set of both lines.

formsandlines commented 1 year ago

Just changed the failing test according to your suggestion, which I hope I understood correctly. I wasn’t sure what exactly “migrate” does and if the order is important.

borkdude commented 1 year ago

Thanks and congrats with your first merged PR :)

formsandlines commented 1 year ago

Glad I could help, had to learn some new things about Git and GitHub along the way. :D