The python and java scripts I use to import and display mastodon comments in a static manner for my Publii site.
  • Handlebars 69.6%
  • Python 30.4%
Find a file
naivchan 7df7e84850
author badge handles
can handle old and new usernames
2026-03-26 23:30:32 -07:00
theme-override author badge handles 2026-03-26 23:30:32 -07:00
add-comment.py Update add-comment.py 2026-01-07 12:52:37 -08:00
README.md Update README.md 2026-01-07 12:59:40 -08:00
sync_comments.py Update sync_comments.py 2026-01-01 09:27:58 -08:00
sync_comments_full.py Update sync_comments_full.py 2026-01-01 09:28:22 -08:00

Change the input and output in sync-comments.py or sync-comments-full.py to your database path and [your-site]/input/media/files/comments.

add-comment.py allows you to add comments manually. You can run the script and follow the directions.

Update your theme using an override to add the mastodonId field, and then add mastodon Id for all your pots that have a post.

Make sure to change the instance and usernames to your own. Mine are left in as "sakurajima.moe" and "navi".

Run sync-comments-full.py first to get all the mastodon json data. The other one is for new blog posts only.

If your theme override is setup and your json data is in the correct folder, Publii will pull the JSON data at build and update the bottom of the page with comments.

You can see an example at https://ranobe.pomnavi.net