Github Action for Syndication Links

Fundor333
3 min readJan 23, 2025

--

A lot of time ago I implement the Webmention in my site following a lot of blogpost.

One of them was a bigger ispiration for my implementation and I have some chat with the author of the post over Mastodon for the implementation of the syndications link in a static site and how to implement it.

After 3 years I find the solution in a post about webmetions!

Paul Kinlan wrote an article in the 2019 which flow under my radar and I didn’read it untile recently.

In this post he use a Github action to write the webmention into a data folder for his GoHugo implementation. He has a script which download the data and put into file (the name of the file is the hash of the url of the post) which are use to render the webpage interested by the webmention. And all of this into Github Actions…

So I start thinking about it more and more… What can I have the syndications links into a file for url? Like the webmention in this post? I need to read the urls form the social media and other stuff.

But now with X/Twitter in bad shape and Facebook/Meta only good for share photos I only use Mastodon so it is easy read them and write a file for url…

A implementation I find is this one by Brandon Rozek that I like in a lot of way but I change it because I don’t use Medium…

So I start with the development:

  1. I need a file type/data structure standard for the Syndication
  2. I need a script (or more) that find the syndication’s links
  3. I need to edit/add to the template some code for the render of it

First are the data structure: json, with the name of the file is an hash of the url

For example this is my data for this post . I choose Json because I can make check on it and it is a beautiful format for data

In this case I find that Mastodon generate a feed for every public profile so I only implementa a reader (class MastodonFinder) which read the feed and save the toots url if find a link to my domain, and a writer class (WriterSyndication) which run all the other class (in this case only the Mastodon one) and write the output as a look-a-like of the json show before.

I wrote in this way because I can change the readers or add new one but all the rest of the code remain the same.

Only thing is I need to implement some code for reading all the old file and add to them and not create a new data file if there is an old one.

I run it as a Github Action with this parameters.

I always put “workflow_dispatch” as one of the running condiction for having a manual button for running it.

This is the template fragment I use to show the syndication of one of the post. It return a single line of text with all the link of the syndication label as the host of the service (as if it is a mastodon.social/xxxx/xxxx link, the label will be mastodon.social).

I also add the microformat2 tags because all my site has them.

I love this way and I am happy because I resolve a problem I had with my blog for 3 years

Originally published at https://fundor333.com on January 23, 2025.

--

--

Fundor333
Fundor333

Written by Fundor333

A Python developer who work on Wordpress projects and make automation scripts. Sometime a Nerd, sometime a Geek always time for tea

No responses yet