Ludochaordic
Fantaisies programatico-ludiques

Pelican, Pingback and Webmentions

Linkback protocols are an old breed. They were born in a time where MySpace, Wikipedia & WordPress had just been launched, and Friendster was more popular than this new website called Facebook.

Diagram showing how linkback protocols work
Diagram source: PPRuNe article on linkbacks

The latest linkback protocol, Webmention, is relatively recent though, as it became a W3C recommendation in 2017.

What are linkback protocols ?

A web mechanism to notify website-B.com when website-A.com publishes content that includes a link to website-B.com.

Basically, website-A.com says “Hello website-B.com ! I have just written something about you, maybe you'd like to know !”

I find linkback protocols very valuable, for several reasons:

  • they have strong technical features: conceptually simple, flexible, lightweight, easy to implement... As they exist since almost 20 years, their robustness has been tried-and-tested.
  • they are a web standard
  • they foster a decentralized web

As such, they form a practical alternative to commenting systems of tech Giants centralized platforms.

Many publishing tools (blog engines, website frameworks...) already support linkbacks. As an example, IndieWeb has a long list of software that support Webmention.

Myself, to generate this website, I am using Pelican, a static blog engine written in Python.

So-called "static" websites are great: they are conceptually simple, they are low tech, and because they are generated only from versionable text documents, they are very resilient.

Sadly, static websites cannot receive linkbacks, as this requires some custom server-side code. However they can perfectly well send linkbacks !

Hence, I have written a Pelican plugin to send linkbacks, with support for both Pingbacks & Webmentions, which I am now proud to introduce here:

https://github.com/pelican-plugins/linkbacks/ Pypi latest version

There are already libraries on Pypi dedicated to publishing linkbacks, for various protocols. However I did not find any which I was satisfied with the code quality, hence I wrote my own implementation.

The send_pingback & send_webmention functions in linkbacks.py are pretty straightforward. They are well tested, and are easily usable in another Python project:

from linkbacks import *

logging.basicConfig(level=logging.DEBUG)
LOGGER.setLevel(logging.DEBUG)

send_pingback(source_url, target_url)
send_webmention(source_url, target_url)

As proof of this library correctly sending notifications, there are two websites that acknowledged reception of Pingback from this blog:

By the way, I learned that most Wordpress websites systematically answer to Pingback requests with a very unhelpful silent faultCode 0, due to the default value of the xmlrpc_pingback_error filter (source). 😞 This was done to prevent Pingback exploits like the infamous CVE-2013-0235 (mitigation commit source), but I don't think this kind of security through obscurity is needed. In fact I fear that the impact of hiding the Pingback submission status in Wordpress was mostly to slow down the adoption of this protocol...

Many thanks to Matthieu for providing me a temporary Wordpress blog, under a different domain, for my tests !

Another side note: maybe in the future I'll write a web-app to receive & store linkback requests, and "plug" it to this blog. Or better, add this feature to isso (cf. issue #19). In the meantime, I have found the webmention.io service very nice & simple to use to add support for Webmention on this blog. As it is centralized, it is not perfect, but it is a good start to support the adoption of this great linkback protocol !

By the way, I suggested to Reddit that they support Webmentions. You can upvote this demand here: feature request.

That's it for today. Of course, I'd be more than happy to get feedback from you if you use this Pelican plugin. 😉 And may the God of Clean Web Protocols & Semantics be with you !

Ooops! you found a Dead Link