Email or username:

Password:

Forgot your password?
David Revoy

I may have found an alternative solution to my blog's commenting system! 😺

The synchronization of comments from my Mastodon account. It's something I tried and abandoned, but I'm giving it another try after reading your comments. Well, I explain more on the blog and also share the source code:

Blog post, source code, and demo:
davidrevoy.com/article981/i-ma

Bonus: Because I'm happy, here's a happy Mastodon mascot as a postman that I painted this morning.
#blog #selfhosting #php

A digital painting of  the Mastodon mascot as a postman, happy delivering message. 

License:  "Mastodon mascot as postman" by David Revoy, based on mascot of joinmastodon.org − CC-BY-4.0
59 comments
Sheldon Chang 🇺🇸

@davidrevoy I’m rebuilding a content platform of mine and I’m all over this. I’ve always wanted a comments board that could be in multiple places at once!

David Frank

@davidrevoy I am sure you also looked into “webmention”? It also does what you would like to do but require a bit of setup.

David Revoy

@bitinn Hey, I'm totally discovering it with your message. Thanks, I only read the introduction on w3.org/TR/webmention/ and I'm really interested. I'll try to find more real life example and integration in PHP.

David Frank

@davidrevoy great I had it setup on one of my blog, with a bridge, you could copy not just replies but also favorites to your blog.

See a quick example on my site (integrated via JavaScript): marisa.club/a-new-adventure/

Jaime Herazo

@davidrevoy
I feel like Lemmy or Kbin would make more sense for this but I guess ActivityPub makes it irrelevant since they can interact anyway

Excellent idea!

Marco Bresciani

@davidrevoy
Glad you're back. hope everything will go fine. 👍🏻

Touhoppai

@davidrevoy Un poil plus compliqué pour poster, mais c'est un faible prix à payer pour la tranquillité d'esprit.
J'espère que l'on aura, à terme, plus d'implémentation activityPub depuis les sites de blog (je crois que WordPress le propose depuis peu) pour que le post avec un lien vers le billet de blog puisse être directement le contenu du blog. Ce serait génial d'arriver jusque là !

David Revoy

@touhoppai Oui, le va-et-vient après avoir fini l'article d'aller poster sur mastodon, récupérer l'ID, et l'entrer dans l'admin est du taf supplémentaire de mon côté. Il y a certainement des façons d'automatiser tout ça, je vais y regarder afin de pouvoir poster plus fluidement.

Nemiryah

Sounds like an amazing way to strengthen participation, good job! 🎉

Julian Fietkau

@davidrevoy It's nice to see another implementation of blog comments using the Mastodon "context" API. 😀 I use it for fietkau.blog in a similar way. I additionally filter the replies by visibility and only show the ones set to "public".

If you'd like to read more about how to render custom emoji and other details, I recommend @cassidy's blog post about his implementation: cassidyjames.com/blog/fedivers

David Revoy

@julian Thank you for the link! Very interesting. 👍

@cassidy

Bloodywing

@davidrevoy *me searching for the xss in your code* :meru_lul:

but it looks fine so far. :meru_headpat:

David Revoy

@bloodywing Oh thanks for checking. I'm really not really skilled at coding PHP, it's limited for my personal use and my blog and Pepper&Carrot website. It you ever see a big mistake in the code I post, do not hesitate to tell me. Thanks.

YoYunix

@davidrevoy I love how it looks exactly the same as the old system. Do you think that after a few years worth of new blog posts that it will ever get to the point where it pings your mastodon instance constantly? It’s cool that it updates every hour, but do you think blog posts will get old enough that you can be safe updating it daily or weekly to avoid this?

David Revoy

@yoyunix Thanks. To be fair, I doubt it will last long. Accidents of instance can happen, losing all comments, or the service might also go sunset and be replaced by a new tech more lightweight in the future. Maybe the API will change too with the new versions, up to a point it's too hard to follow for my low skill.

Right now my system on the blog has a cache of 1h for the post of the week, 4h for the post of the month, and 12h after that. Let see in 5 years if If Mastodon IDs are stable 😉

YoYunix

@davidrevoy any idea what could be a replacement if this fails?

David Revoy

@yoyunix No idea 😇 The future time will bring new challenges but also probably new solutions. I'll study that when it will happen.

nunux

@davidrevoy

Merci pour vos oeuvres et vos contributions à l'Open source.

😉

jcarnu

@davidrevoy
Nice job! Nice news!
I love all your créations, they are so joyful !

ApisNecros

@davidrevoy I'm having troubles creating account on that gitlab instance, but I wanted to let you know that lines 83 and 177 can be removed. You already confirmed that `$mastodon_post_id` only contains numbers, and you don't need a content-type header since it's a GET request

David Revoy

@ApisNecros Thank you for the advice. I'll note the changes and edit it them soon!

Nomis

@davidrevoy nice happy ending, let's hope troll will stay away. Nice postman ❤️

David Revoy

@nomis38 Thanks! Yes, I hope too. I also know the contributors and readers of the blog may help now and take action if they find something to report. It should give a harder time for the trolls and haters to get a message in there with a long life time.

Valvin (framapiaf)

@davidrevoy oh nice! Great you've found the reason of missing posts on framapiaf 🙂

Ben Sunshine

@davidrevoy
Wow nice. I will implement this in my website maybe, wheh ill have a blog, and where was the logo..?
Well enough to do!

Adam Dalliance

@davidrevoy Great. I was gonna suggest that adding activitypub replies to the post was best till you said you'd already tried it.

Glad you've found a way that works.

farcaller

@davidrevoy It's a somewhat roundabout way to comment, but otherwise the experience actually feels nice! Just needs some standard so a browser extension could inject the instance reply UI or something.

David Revoy

@farcaller Thanks, and a standard or a browser extension for that would be indeed a cool idea.

maxmoon 🌱

@davidrevoy Why are our avatars replaced with chatons on the website? Is this because of copyrights?

David Revoy

@utopify_org Hey, Good question. I thought a lot about this. It's because of five good reasons:

1. Bandwidth (with many visitors, hot-linking them to all instance all the time is pretty heavy)
2. Privacy. Hotlinking them would give also log to instance owners of who connect to my website.
3. Loading speed: waiting for all servers to get pictures.
4. Copyright, and/or trolling possibly with p0rn or gore.
5. Aesthetic: I love the cat avatars peppercarrot.com/extras/html/2 🙂

@utopify_org Hey, Good question. I thought a lot about this. It's because of five good reasons:

1. Bandwidth (with many visitors, hot-linking them to all instance all the time is pretty heavy)
2. Privacy. Hotlinking them would give also log to instance owners of who connect to my website.
3. Loading speed: waiting for all servers to get pictures.
4. Copyright, and/or trolling possibly with p0rn or gore.
5. Aesthetic: I love the cat avatars peppercarrot.com/extras/html/2

maxmoon 🌱

@davidrevoy wow, okay, a lot of stuff I wouldn't even thought of until I would run into it.

Thanks for the explanation.

David Revoy

@utopify_org No worry. I ran into all of them deeply and hard. That's why I keep them in mind now.

NeroBurner

@davidrevoy that's an awesome way of having a comment system. Loving it. And thanks a lot for sharing how you set it up :mastoholdhands:

Roni Laukkarinen

@davidrevoy Awesome! I've been wanting for something like this, because didn't get hang of the webmentions. Thank you so much for sharing the code, might as well implement it.

David Revoy

@abosio Thanks for the link. I discovered it this evening thanks to another comment. I'm now curious about his method for fetching the custom emojis 🙂

Anthony Bosio

@davidrevoy Cool, I skimmed through the replies but didn’t see it. I figured it my be worth a review in case there were any useful nuggets like that.

AppleTalk

@davidrevoy thanks for sharing! I’ve experimented with Mastodon-powered comments on my tiny site too. not quite finished with it yet, will definitely look at your code for inspiration.

Klebs (Les Ateliers PHV)

@davidrevoy Merci de nous avoir encouragé à garder les commentaires sur nos blogs, voire à les intégrer à #Mastodon. Le mien n'est pas codé avec PHP mais je crois avoir trouvé qui me servira. À suivre...
En passant, je suis ravi que tu aies trouvé un autre moyen de rester au courant des opinions de tes lecteurs.

~/hyde

@davidrevoy Carl's post inspired me too 😉

Well done 👍

Nartagnan ⏚

@davidrevoy

Quand je suis content, je partage un smiley. Et toi tu nous offre une peinture 😍

Kosmimatis🔥💍

@davidrevoy that is great solution! Bravo!!! Keep up your great job!

loaExMachina

@davidrevoy Hell yeah! The legendary FOSS artist found a FOSS solution! I look forwards to commenting on the next Pepper&Carrot with this system!

🧿 thgs

@davidrevoy aren't the old comments re-federated? There might be a chance you can still get them back. Except those made by people in the instance that had the problem, I would guess the others should federate again.

Or maybe there is an issue with that as the initial post you made is lost? (So all comments along with it have no real reference).

Go Up