You can use Mastodon to add comments to your static blog engine.
https://carlschwan.eu/2020/12/29/adding-comments-to-your-static-blog-with-mastodon/ #webdev #fediverse
@subins2000 This is a lot more complex since the text box will depend on your server and you will need to log into your account.
@carl
you can do this without javascript by loading in data folder and using it in publication.
If you rebuild you website once a day, it does the work.
@subins2000
@jibec @carl @subins2000 can you explain this? thanks
@fluffy @subins2000 @jibec Basically the idea from Jean-Baptiste is to use Hugo capability to load a json to render the comments statically. It's a nice idea but then you need to setup a corn job building the website hourly or daily.
@carl @subins2000 @jibec thanks, i have been meaning to set something like this up and it will be helpful!
@fluffy
here is the code, look at the python script.
https://github.com/languages-in-floss/site
what deacribed carl is correct.
My implementation is quite minimalist (as a non dev, it took me quite some time to understand it from a javascript implementation)
yes, i have a daily script running. Making it faster isn't really needed for my usecase, anyway, the build script takes a few second, no big deal
@subins2000 @carl
@carl What a great idea! Thanks for sharing
@carl This is nice. I use webmentions on my site, and https://brid.gy/ can transform toots into webmentions. If you're not into webmentions, this is a pretty neat trick.
@binyamin Thanks and using webmentions is also nice :)
@carl I am longing for this. Thank you very much, Carl. And glad to see you once again.
(I am a KDE user)
@xosem It should not be much different, also you could play with the reply variable, it contains much more information that could be displayed.
@carl 🥳
@carl This is really awesome, you did a very nice job !
@vincentxavier Merci :)
@en Probably the API is almost the same.
@carl
Nice solution. Beats mine where I just link the post (my no-JavaScript policy).
@torresjrjr It should be also possible to render the comments at build time but then I would have to add a cron job to rebuild my website every hour :)
@carl not really a solution since you rely on 3rd-party services to show comments. when your site and mastodon instance disappear in the future, the information is lost, not includes in archives
i have a concept for a solution to have static comments for static websites
@davidak if I'm understanding this correctly this is essentially how Staticman does comments: https://github.com/eduardoboucas/staticman
@carl I like your fediverse implementation, great work. It should cut down on anonymous spam. I think a Reply/Add comment button (not a text field) next to the Load button would be nice and it can link to: https://linuxrocks.online/interact/105463655803971969?type=reply
Thoughts?
@carl Not very user-friendly but it works !
@carl Very nice. I think I can use this in my WordPress.
@carl Wow fancy!
@carl Nice 😀 So what's your workflow - you publish the post first, then the toot, then edit the published post to include the frontmatter with the toot id?
@apetresc yes :) I just need to be quick so that nobody notice :)
@carl thats pretty cool
@carl I'm with @davidak on the 3rd-party thoughts. Why not https://www.barkdull.org/software/hashover ? It seems greatly underrated and can be self hosted using flat-files for data storage.
@mikael @carl as i understand it it's still a 3rd-party service where the comments are loaded from, that you host yourself
and unlike isso or commento it's written in PHP, which is known for having massive security issues (look at number of CVEs). you use a static page because you don't want PHP on the server! else you could just use Wordpress which has comments
https://posativ.org/isso/
https://commento.io/
all this is not really a solution
@mikael @davidak PHP is not the problem, I use PHP in a lot of websites and when using modern best practice, the language is fine :) The goal when using a static site generator is usually to have a website that is fast and easy to maintain. No database to configure, easy backup, easy apache config, ...
@carl @davidak I'm basically with you, but flat file data storage + PHP pretty much gives you that: no db to configure, easy backup.
Something like https://commentpara.de/ might be a good alternative to your 3rd Mastodon solution too?
@mikael @carl why not use wordpress then? it's very user friendly and has a huge ecosystem
a perfect comment solution would serve the comments in the same http request as the content. then it can be archived. wordpress does it serverside, so it's given there. it's not with comment services that load the comments with JS
and because i try to have a perfect solution, i don't have comments for some years now and don't write blog post i want to get feedback on. so power to your pragmatic solutions
> a perfect comment solution would serve the comments in the same http request as the content.
Yeah, that would be very nice! Sometimes the perfect solution doesn't exist. Sacrificing comments is an unlucky outcome. Hashover or one of those third party Webmention services seems OK. Even better would be being able to self host a webmention service. Something like this: https://github.com/mapkyca/pingback2hook (but more up to date). Does it exist?
@davidak @carl Oh, it does: https://github.com/aaronpk/webmention.io
But stupid simple with PHP would be preferred. 😀
@mikael @carl there exist many small projects, but nothing outstanding. most incomplete or abandoned
i collected some links here: https://codeberg.org/davidak/webseite/issues/7#issuecomment-63328
@davidak @carl Rad collection! More specifically I was referring to a self hosted webmention service so that you don't have to rely on something like https://commentpara.de/ or https://webmention.io/
@mikael @davidak @carl I already have a mailing list for my website (link in profile) that’s linked at the bottom of every post, but I’m thinking about setting up webmentiond by @zerok to forward Webmentions to the list.
Mailing lists allow anyone to participate without setting up an account, and email isn’t web-based; the latter is quite attractive to members of the Gemini and Gopher spaces.
@carl Oh. This is interesting. I might add this to my blog, which I always intended to have Mastodon comments, but I hadn't figured out yet how to do it.
@carl darn, I've had this idea on my list for a while now!
@carl Very cool, I might have to add this to my site. Enjoy being on HN!
@carl Is there a way to have it load comments automatically for example once someone scrolls to the comment section
@fluffy This should be easy using the Intersection Observer API: https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
@carl great idea !
@carl nice, this is a neat concept.
@carl I can see on your Mastodon feed that there are replies, but I can't see them on the blog post itself. Is that intentional?
@carl Testing testing.
An improved enhancement would be to have an embeddable comment text box within the blog post itself!