webmention 历险记freeopen [符文秘录] #webmention
Webmention.io 是建立在 IndieWeb 原则之上的运动，旨在使个人能够拥有和控制他们的在线内容。该运动旨在授权个人拥有和控制其在线内容。
IndieWeb (独立网络) 的核心精神是：
一个静态博客通常会加个评论系统，用于作者与读者的互动。但传统的评论系统往往基于各种账号系统，比如 github, disqus, 如果你没有账号，就不能参与评论。 于是有人想出一个新点子，就是利用广泛使用的社交平台，比如 twitter，将互动内容直接聚合到你的博客系统, 这就是 webmention.io 一个典型应用场景。
Webmention 是一种在您在网站上提及任何 URL 时通知它的简单方法。从接收者的角度来看，这是一种在其他站点提及时请求通知的方式。换句话说，这就像看到论文之间的相互引用或推文之间的相互提及。通过利用 Webmention.io，您可以享受以下好处：
最初看到 webmention 这个概念时，引起我极高的兴趣，立即找了些使用这个思路的网站，它的效果是这个样子的(如下图), 是不是很有意思？
我当时的第一想法，就是这种方案是否能应用于国内的微信朋友圈，如果能把微信朋友圈的留言、点赞等聚合在博客文章的下方，是相当有趣的。然后就是漫长的寻找和资料查询，发现腾讯公司的微信并不对外开放个人朋友圈的查询接口，无法实现这个想法。好吧，那么我就退一步，模仿人家的博客，实现基于 twitter 的评论聚合，总该可以了吧。
等我按照所有的教程，完成了上述步骤后，然后自己在twitter发了篇文章，注册另一个twitter账号对其文章进行评论后，发现完全没有效果。开始，我以为是自己的配置问题，一直在查错，然后错不在我，这次的事故原因是 twitter，号称要学习 微信 的社交网络公司，对第三方应用突然关闭的访问授权，导致 Webmention.io 方案不再成立。不得不说，这就是中心化的恶果，这些建立社交系统的公司确实可以擅自处理和使用用户的数据，而用户自身，本质上无法拥有自己的数据。
- 完全抛弃中心化的社交软件（微信、微博、twitter …）？不现实；
- 等待现有社交软件突发善心，允许可读取个人数据的接口被拥有者授权访问？ 不理智；
- 基于公开协议，寻找或者创建一个去中心化的社交平台，也就是 区块链化 社交系统，这是我期待的；
- 对中心化系统的失望，我准备开始从云端（百度云，苹果的icloud，谷歌云等）逐渐迁移个人数据，包括但不限于 一些笔记、网络密码、照片等，将其本地化，可离线化，这是我觉得很有必要立即开始做的。
is it same like ping back that wordpress used to had?
This is really cool
try to comment with comment parade :)
why dose it say
🔗 Adding webmentions to my blog sebastiandedeyne.com/adding-webment…
‘Adding webmentions to my blog’ sebastiandedeyne.com/adding-webment…
Adding webmentions to my blog — Sebastian De Deyne sebastiandedeyne.com/adding-webment…
I've been interested in the IndieWeb since my colleague, Chris R, hosted the first London IndieWeb meetup years ago and at various points I've played with a few bits of it on my website, e.g. OpenID and IndieAuth. As part of my efforts to move away from Twitter and Facebook, I recently joined the very friendly fosstodon.org Mastodon instance and I noticed quite a lot of toots about the IndieWeb including one which mentioned the indiewebify.me website which walks you through various levels of IndieWeb "compliance". I've been interested in finding out more about Webmentions for a while and this gave me the motivation I needed to give them a try.
It turns out I had already become a citizen of the IndieWeb, i.e. Level 1 compliance, back in June 2013 and amazingly (to me anyway) that functionality was still working. Level 2 compliance is about publishing on the IndieWeb and Level 3 compliance is about federating IndieWeb conversations.
Publishing on the IndieWeb
For level 2, the first step was to markup my home page using the h-card microformat, not to be confused with the older hCard microformat. I started doing this by creating separate hidden markup, but I was unhappy with the amount of duplication. And so, after faffing about with middleman for a while and discovering its nested layouts, I managed to markup some of the existing content to reduce the amount of duplication: h-card & p-name, p-org, p-job-title, p-locality & p-country-name and u-photo, p-note, u-uid & u-url. The validator suggested that it was working OK. So far, so good.
The next step was to markup my blog posts with the h-entry microformat. This was relatively straightforward to implement now that I had a separate
bloglayout and the validator suggested that it was working OK.
At this point, I should have added the ability to send Webmentions to other IndieWeb sites, but it's not completely obvious to me how to do this for a static site. I think I could do it by hooking the
webmentiongem into my GitHub Action-based build, but I decided to skip this step for now given that it's relatively easy to send a Webmention manually using
curland it's not as if I currently blog that frequently!
Federating IndieWeb conversations
I checked that my website is receiving Webmentions OK by commenting on a blog post using commentpara.de. 🎉🎉
Clearly I haven't yet fully achieved even level 2 IndieWeb compliance, but I'm pleased with what I've done so far and, more to the point, what I've learnt in doing it. I should also mention that I found lots of useful advice in the following articles:
Trying to wrap my mind around WebMentions and how I could implement them without resorting to a third-party provider… https://www.freeopen.tech/webmention/ I wonder if a link such as this one would receive a webmention/pingback if I just write about it using Hugo.
This is a very brief note for my own benefit - if you are even slightly interested I recommend following the links to find other authors who have done a much better job of explaining this!
I had previously displayed WebMentions on posts via a script that ran on each pageview, queried webmention.io for mentions relevant to that page and rendered them - entriely based on the original approach documented by Sebastian de Dyne.
In the most recent iteration of changes I have:
- adapted the processing of inbound webmentions so they are pulled periodically into data files in the repo by Github actions, then processed when the site is built so they are baked into the rendered static pages
- added a Netlify build plugin to push outgoing webmentions from my site to the sites I link to
Processing inbound web mentions
- a Github action that runs every thirty minutes and calls a retrieval script
- the retrieval script which pulls webmentions from webmention.io and stores them as data files in the source repo for the site
- a processing script that is run each time the site is built - this reads the raw webmentions and processes them into a form suitable for Hugo to digest
- changes to page layouts to render a webmentions section
For all of this I am indebted to Rowan Manning’s approach.
Sending web mentions when the site is built
This is the other side of the coin. There are a range of approaches, but I decided to go with a Netlify build plugin configured to only run on production builds.
All the examples I could find work by processing the RSS feed for the site, and most take the approach of posting webmentions for any remote sites linked from the last (or a configurable last number of) posts. This will fall down if you ever create more than one post in between publishes - rare but not impossible.
A note to myself - new functionality based on code developed by others, I need to spend some time to make the repo for this site openable, then make it public.now done - here
I’ve added Webmention support to the posts on this blog.
Webmentions are a method for websites to know that they’ve been linked to (or mentioned) from elsewhere on the web.
Webmention is a web standard for mentions and conversations across the web, a powerful building block that is used for a growing federated network of comments, likes, reposts, and other rich interactions across the decentralized social web.
When you link to a website, you can send it a Webmention to notify it. If it supports Webmentions, then that website may display your post as a comment, like, or other response, and presto, you’re having a conversation from one site to another!
It depends on a couple of things being in place for it all to work, but I’ve implemented the basics to fetch and display any mentions that have been detected by the webmention.io service.
I have already been using Github Issues-powered commenting for the past couple of years, so I took the time to consolidate comments and Webmentions in to a single chunk of “interactions” functionality to fetch, cache, and render any comments or Webmentions. This is all done with native JS and could probably be improved further with a framework like Vue.js, but it works fine for now.
I’m using brid.gy to recieve Webmentions from Twitter and Reddit interactions via webmention.io — this will mean that if somebody shares/likes/retweets a link to one of my blog posts on either platform it will display that here below the post.
As you can see it’s a bit complicated, and it feels like it’s held together with duct tape in places, but for now it works!
Lots of others have written about how they’ve implemented Webmentions on their sites, and these write-ups were really useful when arriving at my own implementation.
So to share the love, here are some links to those posts:
- Webmentions - Phil Gyford
- Webmentions for your Static Site - Rowan Manning
- Using Web Mentions in a static site (Hugo) - Paul Kinlan
- Adding Webmention Support to a Static Site - Keith J. Grant
- Adding Webmentions to My Static Hugo Site - Ana Ulin
- Using Webmentions in Eleventy - Max Böck
- Webmentions: Enabling Better Communication on the Internet - Chris Aldrich
- Add Webmention support to your website in ten minutes - Daniel Aleksandersen
- Sending your First Webmention from Scratch - Aaron Parecki
- Implementing Webmention on a static website - Deluvi
- Adding Webmention Support from Scratch - Dwayne Harris
- Social media responses on a Jekyll site using webmentions - James Dinsdale
- Adding webmentions to my blog - Sebastian De Deyne
- A Brief Look at WebMention - Ben Shi
And that’s about it really. I’ll be tweeting a link to this post once it’s published and then any replies or likes will hopefully appear at the bottom of the page.
Back to top