Parsing webmentions

Thanks to everyone who helped me test webmentions that I hacked together at Indie Web Camp last weekend.

Let me explain what web mentions are all about…

Basically, it’s an equivalent to pingback. Let’s say I write something here on adactio.com. Suppose that prompts you to write something in response on your own site. A web mention is a way for you to let me know that your response exists.

If you look in the head of any of my journal posts, you’ll see this link element:

<link rel="webmention" href="http://adactio.com/webmention.php" />

That’s my web mention endpoint: http://adactio.com/webmention.php …it’s kind of like a webhook: a URL that’s intended to be hit by machines rather than people. So when you publish your response to my post, you ping that URL with a POST request that sends two parameters:

  1. target: the URL of my post and
  2. source: the URL of your response.

Ideally your own CMS or blogging system would take care of doing the pinging, but until that’s more widely implemented, I’m providing this form at the end of each of my posts:

Either way, once you ping my web mention endpoint—discoverable through that link rel="webmention"—with those two parameters, I just need to confirm that your post does indeed contain a link to my post—by making a cURL request and parsing your source—and then I return a server response of 202 (Accepted).

Here’s the code for a minimum viable web mention in PHP.

That’s as far as I got at Indie Web Camp but it was enough for me to start collecting responses to posts.

Webmentions as links

The next step is to do something with the responses. After all, I’ve already got the source of each response from those cURL requests.

Barnaby has a written a nice straightforward microformats parser in PHP. I’m using that to check the cURLed source for any responses that have been marked up using h-entry. That’s one of the microformats 2 vocabularies—a much simpler way of writing structured content with microformats.

Aaron, Amber, and Barnaby all sent responses that were marked up with h-entry so now their responses appear in full.

Webmentions as comments

So there you have it. Comments are now open on every journal post on adactio.com …the only catch is that you have to write the comment on your own site. And if you want the content of your post to appear here (instead of just a link) then update your blog post template to include a handful of h-entry classes.

Feel free to use this post as a test. Mark up your blog with h-entry, write a post that links to this URL, and enter the URL of your post in the form below.

Have you published a response to this? :

Comments

Cette page est destinée à étudier le protocole indieweb webmention. En quelques heures, lors de l’indiewebcamp UK à Brighton, nous avons pu voir Jeremy implémenter le protocole sur son site :

Tous les posts de son blog acceptent les webmentions Discovery seulement avec le lien : rel=”webmention” dans le head les posts de blog ont un formulaire de saisie pour coller proprement votre URL de commentaire et envoyer une webmention manuelle Ce qui suit (et reste à implémener ici) est une traduction à raffiner de l’article de Jeremy Keith : http://adactio.com/journal/6495/

Parser les webmentions 15 septembre 2013

Merci à tous ceux qui m’ont aidé à tester webmentions que j’ai hacké à l’Indie Web Camp le weekend dernier.

Laissez-moi vous expliquer ce que sont les web mentions

Basiquement, un équivalent à pingback. Disons que j’écris quelque chose sur adactio.com. Supposons que je vous demande d’écrire quelque chose en réponse sur votre propre site. Une web mention est un moyen à votre disposition pour me faire savoir que votre réponse existe.

Si vous regardez le head de n’importe lequel de mes billets de blog, vous verrez cet élément link :

<link rel="webmention" href="http://adactio.com/webmention.php" />

C’est mon endpoint webmention : http://adactio.com/webmention.php …c’est une forme de webhook : une URL destinée à être atteinte par des machines plutôt que par des personnes. Ainsi, quand vous publiez votre réponse à mon post, vous pinguez cette URL avec une requête POST qui envoie deux paramètres :

target : l’URL de mon post source : l’URL de votre réponse. Idéalement votre propre CMS ou système de blog devrait prendre soin de produire le ping, mais en attendant d’être plus largement implémenté, je fournis ce ce formulaire à la fin de chacun de mes posts :

Dans tous les cas, une fois que vous pinguez mon endpoint-découvrable webmention à travers ce link rel="webmention"—avec ces deux paramètres, j’ai juste besoin de confirmer que votre post contient vraiment un lien vers mon post —en produisant une requête cURL et en parsant votre source— et ensuite, je renvoie une réponse serveur de 202 (Accepted).

Voici le code pour un webmention minimum viable en PHP.

C’est à cette heure tout ce que j’ai reçu lors de l’Indie Web Camp mais suffisant en ce qui me concerne afin de commencer à collecter les réponses aux posts.

La prochaine étape est de faire quelque chose avec les réponses. Après tout, j’ai déjà reçu la source de chaque réponse à partir de ces requêtes cURL.

Barnaby a écrit un beau parseur microformats en PHP. J’utilise ça pour vérifier la source cURLé pour toute réponse qui a été marquée en utilisant h-entry. C’est l’un des vocabulaires microformats 2 —un moyen beaucoup plus simple d’écrire du contenu structuré avec des microformats.

Aaron, Amber, et Barnaby ont tous envoyé des réponses qui ont été marquées avec h-entry, ainsi maintenant leurs réponses apparaissent en entier.

Vous avez l’idée. Les commentaires sont désormais ouverts sur chaque post du journal sur adactio.com … le seul truc est que vous devez écrire le commentaire sur votre propre site. Et si vous voulez que le contenu de votre post apparaisse ici (au lieu d’un lien), alors mettez à jour votre gabarit de blog pour inclure quelques classes h-entry.

Sentez-vous libre d’utiliser ce post pour tester. Marquez votre votre blog avec h-entry, écrivez un post de blog qui fait un lien vers cette URL, et entrez l’URL de votre post dans le formulaire ci-dessous.

11:49pm

Tagué avec

Avez-vous publié une réponse à ça ? Faites-le moi savoir avec votre URL :

Commentaires

“Parsing Webmentions” by @adactio: http://adactio.com/journal/6495/ A step-by-step explanation of how to receive #webmentions and incremental steps you can take afterwards like: * displaying links to posts that mention yours * displaying such posts in their entirety with attribution Well done Jeremy.

# Posted by

Tantek Çelik

on

Sunday, September 15th, 2013 at 4:09pm

adactio: this is awesome! http://adactio.com/journal/6495/

# Posted by

aaronpk

on

Sunday, September 15th, 2013 at 4:21pm

Jeremy has recently implemented Webmention on adactio.com, and posted an explanation of the small piece of code involved. I I love the simplicity of Webmention, and I love the Indieweb idea of connecting our conversations in the simplest possible way whilst still publishing to our own sites, owning our data. I intend to implement it on this site as soon as I can: both to test it out, and to offer a way of commenting without all the hassle of actually managing comments (sort of).

I do have one teensy tiny criticism though: what’s that little bit of tech-specific junk doing in the Webmention URL, Jeremy? “Dot PHP”? Cool URI:s don’t change, but publishing platforms and script languages do, right? Excuse me sir, your CMS is showing! :-)

# Posted by

Emil Björklund

on

Monday, September 16th, 2013 at 10:24am

In 2007 and 2011 I wrote a pair of articles where I tried to articulate my thoughts on what I saw as the dawning social web. The earliest article was about Google’s OpenSocial API, and the latter, about what I saw as Google’s new social network, built around profiles, rel=me and Buzz.

Neither came to pass. OpenSocial died a slow, painful death, while Buzz was kicked in the teeth, then taken out back and shot. But, what they demonstrated was Google’s attempts at socialising the web itself. Of course, this dream died when Google+ was released as a Facebook-clone and Google returned to only being an advertising company.

But, others have been continued working on freeing the web for us.

IndieWeb

Individuals like Tantek Çelik, Barnaby Walters, Jeremy Keith and many others are tirelessly working on ensuring that the content we create is recognised as ours, controlled by us and, in the end, owned by us. This work is best articulated by the principles of the IndieWeb.

One of the latest pieces of work developed by Jeremy Keith is webmentions.

Webmentions

Webmentions allows conversations, that would usually occur in comments, to take place on your own website. Pinging back responses to the original article allows readers to follow the discussion of articles and comments, while the content itself continues to be hosted on the respondent’s website and owned by them - fulfilling the IndieWeb principles.

Google Buzz performed this kind of aggregation and connecting. It allowed conversations to happen across the web and be followed in one place.

Webmentions picks up where Buzz left off and adds the ability to host the conversation itself to the mix.

A fantastic tool that I can’t wait to implement on this site.

# Posted by

Kevin Beynon

on

Monday, September 16th, 2013 at 11:36am

http://inkdroid.org/journal/2013/09/16/mentioning-webmention/

# Posted on

Monday, September 16th, 2013 at 7:03pm

@sandeepshetty @pfefferle cweiske Something new to consider: Jeremy Keith added a webmention sending form to his journal entries to help people who’s websites don’t support webmention already. Being able to test and use webmention through a human visible, interactable form is a huge benefit of using HTTP form encoded data.

We can make this an even stronger case by encouraging success and error responses to be full HTML documents with helpful copy.

See also * http://tantek.com/2013/258/t2/web-protocols-should-use-http-params-no-xml * http://adactio.com/journal/6469/ * http://adactio.com/journal/6495/

# Posted by

Barnaby Walters

on

Friday, September 27th, 2013 at 5:01pm

http://yatil.net/webmentions-adactiocom

# Posted on

Monday, October 7th, 2013 at 2:42pm

Illustrations

Grâce à la magie des tags machine, vous pouvez illustrer ce post en taguant une image sur Flickr avec :

Récupérée de « http://christopheducamp.com/w/index.php?title=Parserleswebmentions&oldid=7130 »

# Posted by xtof on Thursday, January 1st, 1970 at 1:00am

"Parsing Webmentions" by @adactio: http://adactio.com/journal/6495/ A step-by-step explanation of how to receive #webmentions and incremental steps you can take afterwards like: * displaying links to posts that mention yours * displaying such posts in their entirety with attribution Well done Jeremy.

adactio: this is awesome! http://adactio.com/journal/6495/

# Posted by aaronpk on Sunday, September 15th, 2013 at 4:21pm

Jeremy has recently implemented Webmention on adactio.com, and posted an explanation of the small piece of code involved. I I love the simplicity of Webmention, and I love the Indieweb idea of connecting our conversations in the simplest possible way whilst still publishing to our own sites, owning our data. I intend to implement it on this site as soon as I can: both to test it out, and to offer a way of commenting without all the hassle of actually managing comments (sort of).

I do have one teensy tiny criticism though: what’s that little bit of tech-specific junk doing in the Webmention URL, Jeremy? “Dot PHP”? Cool URI:s don’t change, but publishing platforms and script languages do, right? Excuse me sir, your CMS is showing! :-)

In 2007 and 2011 I wrote a pair of articles where I tried to articulate my thoughts on what I saw as the dawning social web. The earliest article was about Google’s OpenSocial API, and the latter, about what I saw as Google’s new social network, built around profiles, rel=me and Buzz.

Neither came to pass. OpenSocial died a slow, painful death, while Buzz was kicked in the teeth, then taken out back and shot. But, what they demonstrated was Google’s attempts at socialising the web itself. Of course, this dream died when Google+ was released as a Facebook-clone and Google returned to only being an advertising company.

But, others have been continued working on freeing the web for us.

IndieWeb

Individuals like Tantek Çelik, Barnaby Walters, Jeremy Keith and many others are tirelessly working on ensuring that the content we create is recognised as ours, controlled by us and, in the end, owned by us. This work is best articulated by the principles of the IndieWeb.

One of the latest pieces of work developed by Jeremy Keith is webmentions.

Webmentions

Webmentions allows conversations, that would usually occur in comments, to take place on your own website. Pinging back responses to the original article allows readers to follow the discussion of articles and comments, while the content itself continues to be hosted on the respondent’s website and owned by them - fulfilling the IndieWeb principles.

Google Buzz performed this kind of aggregation and connecting. It allowed conversations to happen across the web and be followed in one place.

Webmentions picks up where Buzz left off and adds the ability to host the conversation itself to the mix.

A fantastic tool that I can’t wait to implement on this site.

@sandeepshetty @pfefferle cweiske Something new to consider: Jeremy Keith added a webmention sending form to his journal entries to help people who’s websites don’t support webmention already. Being able to test and use webmention through a human visible, interactable form is a huge benefit of using HTTP form encoded data.

We can make this an even stronger case by encouraging success and error responses to be full HTML documents with helpful copy.

See also * http://tantek.com/2013/258/t2/web-protocols-should-use-http-params-no-xml * http://adactio.com/journal/6469/ * http://adactio.com/journal/6495/

This site does not have a way for readers to post comments under each article. And I plan not to implement a comment section. Instead, now Parallel Transport accepts webmentions, so you can write and publish responses on your own place on the web and link it back to the original article here. In fact this very article appears as a response on Jeremy Keith’s post.

Comments & Feedback Most comments are useless. They do not contribute much to the original content. They’re mostly one-line quips about liking or disliking the post. No context, no feedback, no thought. Having a comment form makes it very easy to post a random comment on some website. Combine that with the anonymity it affords, comment sections are breeding grounds for trolls, unconstructive arguments, flaming, name-calling, and shouting matches. No wonder the bottom-half of the internet is so despised. Second; why this expectation that every blog must be a discussion forum? Public discussions can be had on social platforms like Facebook, Twitter, Google+. If you really have some response to what I write, you can use email or catch me on one of the aforementioned social site places. Or better yet, write your own post about it on your own blog, site, journal, social-network-thingie!

You write on your site; I write on mine. That’s a response.

—John Gruber on I’ll Tell You What’s FairIf your response, adds something of value to the original content, I’ll post it here. I have transfered many such valued comments over from my old blog. Not all of them agreed with what I had to say, but they were considered responses, instead of just ‘I like it!’ or ‘This is shit!’. Webmention So suppose you have published a response on your own site. Webmention is a way to notify me of your response. You send the URL of your response along with the URL of my original article as a POST request to my web server. My server verifies that the response post exists and that it links to the original article. Now, I can do something with your response. I could simply link to it below my article, or repost your entire response. I have chosen to take a middle-ground and display a little snippet with a nice link back to your original post. If all goes well, you would have responded to my article with one of your own, published on your own site, and still have a discussion that links back and forth. Since, most web-publishing platforms don’t support sending mentions automatically, following Jeremy Keith, I have a small form at the bottom of every article that you can use to send me the link to your response post. If you are interested in the details of how this works, take a look at the webmention spec, and the informative discussion at the IndieWeb. If, like me, you use and love Python, Panayotis Vryonis has written a good tool to handle webmentions. You can also see my own webmention code, which extends Vryonis’ webmentiontools to do a few more things. Feel free to make suggestions, test, extend and use it. And if you do, let me know. Or better yet, write about it and link it back here!

Related reading: Comments still off —Matt Gemmell Why I dont’t have comments —Seth Godin Why you can’t comment here—Panayotis Vryonis Parsing webmentions — Jeremy Keith. Also, read the wonderful webmention-ed articles at the end. IndieWeb Principles Comparison table of linkback methods on Wikipedia.

# Wednesday, November 20th, 2013 at 12:00am