---
title: The IndieWeb and Webmentions
date: 2020-01-13 14:47
slug: the-indieweb-and-webmentions
categories:
- Code
tags:
- social
- comments
- indieweb
---

[bridgy]: https://fed.brid.gy/
[indiewebify]: https://indiewebify.me/
[evantravers]: http://evantravers.com/articles/2019/11/14/indieweb-webmentions-on-middleman-or-jekyll/
[kiethjgrant]: https://keithjgrant.com/posts/2019/02/adding-webmention-support-to-a-static-site/
[hcard]: http://microformats.org/wiki/h-card
[hentry]: http://microformats.org/wiki/h-entry
[hfeed]: http://microformats.org/wiki/h-feed
[webmention]: https://webmention.io/
[activity]: https://brettterpstra.com/2019/11/19/forgiveness-peace-and-productivity/
[xray]: https://xray.p3k.io/
[indieweb]: https://indieweb.org/

![](https://brettterpstra.com/uploads/2019/12/indiewebheader-rb.png)

I don't know if you've noticed, but a while back I added a nifty feature to posts on this site which displays activity from Twitter and Mastodon (likes, retweets, replies) on each post. In most cases, more responses to my work happen on social media than in post comments, so I really wanted to be able to integrate those social mentions with the existing comments. This is a static site running on [Jekyll](https://jekyllrb.com/), so it took a little extra work and relies on a few external services.

![Screenshot of Webmentions as displayed on BrettTerpstra.com post](https://brettterpstra.com/uploads/2019/12/webmentions.png)

<!--more-->

I got the idea for this from Evan Travers, who did [a writeup of how he's accomplishing it][evantravers] on his own site. It all starts with the [IndieWeb][]. I'm going to list the steps I took for reference, but don't consider this any kind of tutorial. All of the information you need can be found in the Evan's post, as well as posts from [Kieth Grant][kiethjgrant] and tips from [indiewebify.me][indiewebify].

Here's what it took:

- I added microformat markup to the site
	- [hcard][hcard] with my author/contact info for every post and on index pages
	- [hentry][hentry] for post bodies
	- [hfeed][hfeed] for indexes and feeds
	- Validation via [indiewebify.me][indiewebify] and [xray][]
- Set up [IndieWeb sign-in](https://indieweb.org/How_to_set_up_web_sign-in_on_your_own_domain)
	- I used GitHub as my sign-in source, ensuring my profile there had a link to my site, and then including a `rel="me"` link to my GitHub profile on my own site
- set up [Bridgy Fed][bridgy] to scrape for mentions on my various social platforms, and [webmention.io][webmention] as an API for collecting them.
- To be kind to the WebMention API, I set up a script that runs at 30-minute intervals, retrieving new mentions and caching them in a JSON file
- To prevent massive filtering in the browser, I added a CGI to my site that reads the cached JSON server-side and returns all mentions for a particular post as an array, sorted by date received
- The markup for the mentions is generated and inserted dynamically on page load using `jQuery.getJSON` and the output of the CGI

You can see a good example of the result in action on [this post from November][activity]. Scroll to the end of the post to see the social activity ("mentions").

It was a fun experiment, and I'm happy to have broader interactions than just local comments on the posts. If you're interested in any of the scripts I'm using (crawler, CGI, jQuery), just let me know, I'm happy to share.

---

Brett is a writer and developer living in Minnesota, USA. You can follow him as ttscoff. This content is supported by readers like you. [More about Brett](https://brettterpstra.com/contact.md), including social links.

Copyright © 2026 Brett Terpstra. All rights reserved.
