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:

source=https://ruk.ca/content/digging-webmention
target=https://www.zylstra.org/blog/2018/07/wrapping-my-head-around-webmentions

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:

https://www.zylstra.org/blog/2018/07/wrapping-my-head-around-webmentions
https://indieweb.org/Webmention
https://www.drupal.org/project/vinculum
https://webmention.io
https://ruk.ca/content/digging-webmention
https://www.zylstra.org/blog/wp-json/webmention/1.0/endpoint
https://aaronparecki.com/2018/06/30/11/your-first-webmention
https://indiewebify.me/

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

https://www.zylstra.org/blog/wp-json/webmention/1.0/endpoint
https://webmention.io/indiewebcamp/webmention
https://webmention.io/pingback/webmention
https://webmention.io/aaronpk/webmention

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).

Comments

Submitted by Frank Meeuwsen on

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!

Add new comment

Plain text

  • Allowed HTML tags: <b> <i> <em> <strong> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

About This Blog

I am . I am a writer, printer, and curious person.

To learn more about me, read my /nowlook at my bio, read presentations and speeches I’ve written, or get in touch (peter@rukavina.net is the quickest way). You can subscribe to an RSS feed of posts, an RSS feed of comments, or receive a daily digests of posts by email.

Search