This is part two of a blog post that turned out to be a bit too long. Don’t miss Part 1: Hexo and the IndieWeb …
After you have created your new Hexo post with
hexo new post "My Fancy Post" and spend a couple of minutes/hours/days on writing meaningful text, you publish it by running
hexo generate and copying the generated HTML to your server.
Next step would be to inform all the blogs you linked to in your now published post, that you have done just that. You want to send Webmentions.
Good news: you don’t have to write your own solution to scan your article for external URL’s and sending Webmentions to their creators: Remy Sharp has done that already with his service webmention.app. It supports the long existing Pingbacks too and offers several ways to achieve your goal:
(1) Use the service at https://webmention.app/test manually with your newly published article URL
Very time consuming approach and actually only intended for tests. You rely on Remy’s service and need a token to avoid existing rate limits.
(2) Perform a POST of your new article URL or the URL of your RSS feed to his service endpoint using CURL or any other HTTP requesting method
Can be integrated at the end of your build & deploy process. Rely on Remy’s service and needs a token.
(3) Use IFTTT to do the job described in (2) using your feed
Seems best way for ‘set up and forget’, but you rely not only on Remy’s service, but on IFTTT also. Not really controllable.
(4) Use his Command line tool independently
Use the executable behind Remy’s service on your own, without tokens and stuff. Integrable into your build & deploy process and the source code is available on Github, in case you want to change it to your needs.
Whatever method you use: If you use your RSS feed for scanning, you have to ensure, that your feeds content contains the complete text of your article and not only the excerpt, in case you work with Hexo’s
<!-- more --> feature.
To avoid having to look up the published URL each time, I wrote a Hexo console command that either processes a post by its filename (slug) or simply the last ones. It is based on and uses Remy’s NPM package.
You can install hexo-console-webmention by executing:
npm install hexo-console-webmention --save
The command has 3 options:
|slug||string||Parse a particular post by its filename (slug)|
|count||int||Parse a number of latest posts (not considered when –slug is used)>; default = 1|
|send||bool||Parse and send Webmentions (without, only the endpoints found are displayed)|
Parse and show endpoints for the latest post:
Parse and show endpoints for the latest 20 posts:
hexo webmention --count 20
Parse and send Webmentions for the latest post:
hexo webmention --send true
Parse and send Webmentions for the post “My Fancy Blogpost”:
hexo webmention --slug my-fancy-blogpost --send true
The source code is available at: https://github.com/kristofzerbe/hexo-console-webmention.
Do not linger … this way to Part 3: Hexo and the IndieWeb (Receiving Webmentions) …
You can interact with this article (applause, criticism, whatever) by mention it in one of your posts, which will be shown here as a Webmention ... or you leave a good old comment with your GitHub account.
In case your blog software can't send Webmentions, you can use this form:
No Webmentions yet...