barryf / vibrancy

Headless CMS and Micropub endpoint for personal websites. Used for the back-end of https://barryfrost.com
MIT License
20 stars 2 forks source link

Add support for arbitrary post-rewriting middleware #24

Open jamietanna opened 2 years ago

jamietanna commented 2 years ago

Currently, I have two main usecases in which my Micropub endpoint modifies the incoming request before saving it, which the latter of which would be quite key for me to move over:

(There are other cases, like "if I'm replying to Twitter, add a syndication link, but those are lower priority)

barryf commented 2 years ago

My website marks up tweet handles and hashtags in text content via regexes in the view layer^1. I think this sort of transformation should be the client's responsibility, not the server's. The server stores and serves text; the client renders the post how it wishes.

jamietanna commented 2 years ago

Interesting, so I'd spent a while thinking about which way I wanted to go with it, and I decided that having it done Micropub-side means that I could own my hashtags (I've been meaning to blog about it for a while) so when I'm at an event tweeting about #PHPMiNDS, I can easily go back to /tags/phpminds/, because although the hashtags are technically for the final syndicated content, it's useful for my site too

barryf commented 2 years ago

I see. I've been a bit more specific about how I use categories/tags. I'll manually enter them in Micropublish when creating a note or other post types and then index them for lists, e.g. https://barryfrost.com/categories/indieweb

jamietanna commented 2 years ago

If the hooks are available for extension, I'd be happy maintaining the code in my fork, then its not enforced for everyone? I'd be wanting to add Micropub CRUD for the different options too, so it longer term won't just be "do the rewrite"