Package: pelican-plugin-linkbacks
Pelicanplugin implementingLinkbackprotocols,
on the linking server side.Protocols currently implemented:XMLRPC Pingback:protocol specWebmention:protocol spec-W3C Recommendation❌ Refback: won't be implemented because it requires to retrieve the HTTPRefererheader,
which cannot be done by Pelican, a static blog engine❌ TalkBack: won't be implemented because it did not gain enough popularity / traction since its birth in 2011❌ Trackback (protocol spec):
won't be implemented because it does not seem widely used,
and requires to parse embedded RDF documents (enclosed in HTML comments as a fallback),
which seems a poor design in an era of HTML5 /RDFaDo not hesitate to suggest other protocols, or report your experience with this plugin, by submitting anissue.What are linkbacks?A linkback is a method for Web authors to obtain notifications when other authors link to one of their documents.
This enables authors to keep track of who is linking to, or referring to, their articles.
The four methods (Refback, Trackback, Pingback and Webmention) differ in how they accomplish this task.I invite you to read this Wikipedia page for more information & links:LinkbackWhat does this plugin do?For every hyperlink in your articles, this plugin will notify their hosting websites
(just those supporting a Linkback protocol) of those references.This plugindoes notperform inclusion of Linkbacksin your articles / as comments,
for every website referencing your content following a Linkback protocol,
because this cannot be performed by a static website generator like Pelican.When you enable this plugin the first time, it will process all the hyperlinks of your existing articles.
It will do it only once, and then create a cache file to avoid processing those links next time.
Still, because thepublishstep will be longer than usual the first time you enable this plugin,
I recommend to usepelican -Dflag to get debug logs, and hence follow the plugin progress.Installation / setup instructionsTo enable this plugin:Install the package from Pypi:pip install pelican-plugin-linkbacksAdd the plugin to yourpublishconf.py:PLUGINS=[...,'linkbacks']CacheIn order to avoid the repetitive CPU / bandwidth cost of repeatedly performing links parsing & linkback notifications,
this hook only proceed to do so once, the first time an article is published.In order to do so, it uses a very simple and small cache that contains the list of all hyperlinks already parsed, per articleslug.To remove a blog entry from cache, in order for the plugin to retry sending a linkback:jq "del(.['$slug'])" pelican-plugin-linkbacks.json | sponge pelican-plugin-linkbacks.jsonConfigurationAvailable options:LINKBACKS_CACHEPATH(optional, default:$CACHE_PATH/pelican-plugin-linkbacks.json,
where$CACHE_PATHisa Pelican setting) :
the path to the JSON file containg this plugin cache (a list of URLs already processed).LINKBACKS_USERAGENT(optional, default:pelican-plugin-linkbacks) :
theUser-AgentHTTP header to use while sending notifications.LINKBACKS_CERT_VERIFY(optional, default:False) :
enforce HTTPS certificates verification when sending linkbacksLINKBACKS_REQUEST_TIMEOUT(optional, in seconds, default:3) :
time in seconds allowed for each HTTP linkback request before abandonContributingContributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation,
adding missing features, and fixing bugs. You can also help out by reviewing and commenting onexisting issues.To start contributing to this plugin, review theContributing to Pelicandocumentation,
beginning with theContributing Codesection.Releasing a new versionWith a valid~/.pypirc:updateCHANGELOG.mdbump version inpyproject.tomlpoetry build && poetry publishperform a release on GitGub, including the description added toCHANGELOG.mdLinter & testsTo execute them:pylint *linkbacks.py
pytestIntegration testsYou'll find some advices & resources onindieweb.org:pingback page,webmention page.For WebMentions specifically, thewebmention.ioservice can be useful.For Pingbacks, I used for my tests a Wordpress instance launched with Docker:docker run --rm -p 80:80 -e WORDPRESS_DB_HOST=host.docker.internal -e WORDPRESS_DB_USER=... -e WORDPRESS_DB_PASSWORD=... wordpressFrom my experience, you'll also have to:configure a local MySQL database to accept connections from$WORDPRESS_DB_USER:$WORDPRESS_DB_PASSWORDconfigure thexmlrpc_pingback_errorWordpress filter to bepassthrough, to get useful error messagesconfigure thehttp_request_host_is_externalWordpress filter to always returntrue,
so that it won't rejecthost.docker.internallinksWordpress client source code related to XML-RPC pingbacks can be found there:wp-includes/comment.phpwp-includes/class-wp-xmlrpc-server.php