03 Jan 2019
Creating Webmention Replies In Jekyll
After installing Aaron Parecki’s jekyll-webmention gem, there was still more to do on my end before a webmention reply would work. There was the IndieWeb documentation on webmention replies and I had seen it before but it hadn’t really made sense until I had to actually implement it. Because as I understood it from Aaron’s documentation and other webmention posts found that all I had to do was install his gem and add a link to my post and the rest would work itself out. They left out this connecting part that I’m writing here. If you’re good at finding everything and putting it together then you can stop reading but if you want to have it explained to you that that jekyll-webmention gem plus this code portion is needed for the whole to work, then you’ve come to the right place.
Here’s how I set it up on this Jekyll install for posts so when I went to write a post, I could include a reply if it was needed. Before my
_layouts/post.html only had the
<p> content </p>1 output and that’s fine but I don’t want to remember what the HTML is everytime I want to include a webmention reply. I created page variables to speed up the work. I’m not using Jekyll Generators because I’m using a Continuous Integration (CI) service instead of my terminal. That would be a faster method but I have Prose.io for now.
This code can be applied to other layouts as you need. In the
_layouts/post.html file replace
<p> content </p> with that below and add more IFs for other webmention response post types:
When I create a new post, my additional front matter is that below and
is a boolean value to enable or disable the extra code above instead of showing only
<p> content </p> from a standard blog post:
And this is my Prose.io code for config.yml:
In bold because curly braces surrounding content was not working in code block. ↩