Digging into Webmention

One of the points of writing on the Internet is our ability to link pages together in a web. We do this in HTML with links, like this:

My friend Ton <a href="https://www.zylstra.org/blog/2018/07/wrapping-my-head-around-webmentions">writes about Webmention</a>.

When that HTML appears here on my website, it looks like this:

My friend Ton writes about Webmention.

And if you click that link, you go to Ton’s blog post.

Wouldn’t it be nice if Ton had way of knowing he was linked to!

That’s what Webmention is for. In addition to the linking, Webmention involves a notification–”hey other website, you got linked to.”

The message is simple; if I want to let Ton’s website know that I’ve linked to it, I send it:


To know where to send it, I need to look at the source of Ton’s page–my target–for something that looks like this:

<link rel="webmention" href="https://www.zylstra.org/blog/wp-json/webmention/1.0/endpoint" />

That tells me “to let this blog post know it was linked to, send the Webmention to this URL.”

(It there’s nothing on the other end of the link that references Webmention, it’s safe to assume it doesn’t receive them, and not send a message; Webmention remains a nascent standard).

Drupal 7, which I use to manage this blog, has no built-in support for Webmentions. The Vinculum module comes tantalizingly close to supporting them, but hasn’t been updated in a long while, and it doesn’t work out of the box.

To work around this limitation, I ripped out the best parts of Vinculum–yeah open source!–and wrote my own Webmention module. Right now it only sends Webmentions, which is okay because, for the time-being, I can use the excellent non-intrusive Webmention.io to handle that part.

As Ton writes in his post, “The webmention itself is simple… What happens next is less simple.”

Here’s the less-simple part that happens once I click “Post”.

First, my module has to look at the body of my post and extract the URLs of all the pages I’ve linked to; for this post, it gets:


Next it has to find out which of those, if any, have the ability to receive Webmentions; it finds these endpoints:


And, finally, for each of those it sends the actual Webmention.

If you’re looking at adding Webmention superpowers to your writing on the web, take a look at Sending your First Webmention from Scratch, which is a very clear step-by-step guide to the system, with some helpful pointers to its fiddly bits. And, indeed, because I sent that post a Webmention, you’ll find a link back here:

Screen shot of a webmention

The IndieWebify.Me tool is also a useful resource for debugging the same fiddly bits.

(By the way, should you send a Webmention to this post, it will be received but not–yet–displayed here; that’s my next step).


Frank Meeuwsen's picture
Frank Meeuwsen on July 7, 2018 - 05:47 Permalink

Hey Peter
I wrote a (first) follow-up article. Since I still have no idea how to automatically send webmentions with Jekyll, I wanted to leave a webmention here. But you miss an entrybox for it, am I right? So here's the link to the article, still in Dutch though... http://diggingthedigital.com/Een-korte-update-over-microformats/

Thanks for your help and insights so far!