davidrevoy,
@davidrevoy@framapiaf.org avatar

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:
https://www.davidrevoy.com/article981/i-may-have-found-an-alternative-solution-to-my-blogs-comment-system

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

julian,
@julian@fietkau.social avatar

@davidrevoy It's nice to see another implementation of blog comments using the Mastodon "context" API. 😀 I use it for https://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: https://cassidyjames.com/blog/fediverse-blog-comments-mastodon/

davidrevoy,
@davidrevoy@framapiaf.org avatar

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

@cassidy

aki_goupil,

@davidrevoy Oh, that's a really good idea! I struggle a bit with accounts all over the place, so I avoid creating any that isn't necessary. Because of this I had never commented on your blog, even though many articles interest me greatly!

davidrevoy,
@davidrevoy@framapiaf.org avatar

@aki_goupil 🙂 Yes, same. Difficult to keep many accounts. Your comment just got sync on the blog, btw: https://www.davidrevoy.com/article981/i-may-have-found-an-alternative-solution-to-my-blogs-comment-system/show#110819217168609542 (if you want to check the concept working 'live'), my reply will now take 4h to appear.

aki_goupil,

@davidrevoy I did! I opened the blog link even before, because I wanted to see how it looked. I really like this new system.

stsquad,
@stsquad@mastodon.org.uk avatar

@davidrevoy
I've done something similar for my blog although the solution is entirely client side JavaScript. It did take me on a deep dive into xss server metadata though for my previously fully static site.
@remram44

danielsiepmann,

deleted_by_author

  • Loading...
  • davidrevoy,
    @davidrevoy@framapiaf.org avatar

    @danielsiepmann 🙂
    I'll try to update a tiny bit the display part of the code this afternoon/evening (on the same page) : I had feedback on how to improve security and also I found aesthetic improvements for situations I met on the way (eg. differentiate video/image/other in attachment, or removing direct/private message from the listing with the token).

    davidrevoy,
    @davidrevoy@framapiaf.org avatar

    @danielsiepmann ... And it is done. I updated the blog post and live demo https://www.davidrevoy.com/article981/i-may-have-found-an-alternative-solution-to-my-blogs-comment-system , but the most important is now that I moved the script to its own git repository https://framagit.org/Deevad/mastocomblog , it will be easier to maintain and push on it the feedback I receive.

    thgs,
    @thgs@phpc.social avatar

    @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).

    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!

    nartagnan,
    @nartagnan@mstdn.fr avatar

    @davidrevoy

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

    hyde,
    @hyde@lazybear.social avatar

    @davidrevoy Carl's post inspired me too 😉

    Well done 👍

    lesateliersphv,

    @davidrevoy Merci de nous avoir encouragé à garder les commentaires sur nos blogs, voire à les intégrer à . 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.

    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.

    abosio,
    @abosio@fosstodon.org avatar
    davidrevoy,
    @davidrevoy@framapiaf.org avatar

    @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 🙂

    abosio,
    @abosio@fosstodon.org avatar

    @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.

    rolle,
    @rolle@mementomori.social avatar

    @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.

    RupertReynolds,
    @RupertReynolds@hachyderm.io avatar

    @davidrevoy And now I'm happy too :-)

    nooe,

    @davidrevoy

    Seems to work smoothly, congrats!

    utopify_org,
    @utopify_org@veganism.social avatar

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

    davidrevoy,
    @davidrevoy@framapiaf.org avatar

    @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 https://www.peppercarrot.com/extras/html/2016_cat-generator/index.php 🙂
    utopify_org,
    @utopify_org@veganism.social avatar

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

    Thanks for the explanation.

    davidrevoy,
    @davidrevoy@framapiaf.org avatar

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

    lilnpc,

    @davidrevoy so cute 😆

    farcaller,
    @farcaller@hdev.im avatar

    @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.

    davidrevoy,
    @davidrevoy@framapiaf.org avatar

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

    pre,

    @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.

    valvin,

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

    davidrevoy,
    @davidrevoy@framapiaf.org avatar

    @valvin 🙂

    GeekAndDad,
    @GeekAndDad@mastodon.social avatar

    @davidrevoy Love the image!

    nomis38,

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

    davidrevoy,
    @davidrevoy@framapiaf.org avatar

    @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.

    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

    davidrevoy,
    @davidrevoy@framapiaf.org avatar

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

    jcarnu,
    @jcarnu@mastodon.xyz avatar

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

    davidrevoy,
    @davidrevoy@framapiaf.org avatar

    @jcarnu ☺️ Thanks!

    nunux,
    @nunux@mastodon.social avatar

    @davidrevoy

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

    😉

    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?

    davidrevoy,
    @davidrevoy@framapiaf.org avatar

    @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?

    davidrevoy,
    @davidrevoy@framapiaf.org avatar

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

  • All
  • Subscribed
  • Moderated
  • Favorites
  • Blog
  • ethstaker
  • DreamBathrooms
  • mdbf
  • InstantRegret
  • ngwrru68w68
  • magazineikmin
  • everett
  • thenastyranch
  • Youngstown
  • slotface
  • cisconetworking
  • kavyap
  • osvaldo12
  • modclub
  • megavids
  • GTA5RPClips
  • khanakhh
  • tacticalgear
  • Durango
  • rosin
  • normalnudes
  • Leos
  • provamag3
  • tester
  • cubers
  • anitta
  • JUstTest
  • lostlight
  • All magazines