{
"$type": "site.standard.document",
"canonicalUrl": "https://handyman5.github.io//posts/bluesky-comments",
"path": "/posts/bluesky-comments",
"publishedAt": "2024-12-06T08:29:47.000Z",
"site": "at://did:plc:yxhvd47p53gmb5zfiktqq3og/site.standard.publication/3mohn6mqvab25",
"textContent": "As of this post, posts on this blog will each be associated with a Bluesky post and display that post and its responses inline.\n\n\n\nI was inspired to do this by several example implementations. It's particularly appealing for a static blog to manage comments in this way, since I don't have to set up Disqus or maintain any kind of backend service myself to handle comments.\n\nI started with the Nikola mastodoncomments plugin. My implementation of the Bluesky version is in the repo for this blog at <https://github.com/handyman5/handyman5.github.com/tree/src/plugins/blueskycomments>; I don't have the time to pretty it up and submit a PR, but it's available if anybody wants to purloin it and do so.\n\nI ran into quite a bit of trouble though, since Nikola doesn't support any modern Javascript frontend systems (like React) out of the box. I had to write my own implementation and my Javascript is very rusty. I like what I wound up with, though; since it's using the oEmbed widget, the posts will always be rendered with the newest features, and I didn't have to go to the trouble of tinkering with the Bluesky API apart from getting the post responses in the first place. I could have added support for npm to my automated build pipeline and used this npm package but I don't know npm well and I worried it'd be overkill. If I run into any problems with my code, though, I'll probably switch to that rather than pouring lots of time into tinkering.\n\nThe other trouble I ran into is that the logic uses a fetch function to grab each comment, and it was appending them into the body in an arbitrary order based on when the functions returned. It took me a while to figure out a good strategy for ensuring that the comments appear in the correct order (i.e. the way the API returns the set initially). I don't have an implementation of nesting the replies, but I can't imagine any of my posts will get _that_ many responses so I'm not super worried about it. 😅\n\nAt any rate, it's working, and I'm jazzed.",
"title": "Bluesky Comments"
}