jekyll-extract-links plugin
When I’m reading other people’s posts, I often click interesting links open as I find them, but Matt Webb’s post about printed QR codes in books got me thinking about how I’d often like to see a collected list of links in regular blog posts too, particularly if the article or post is a long one.
Terence Eden touches on this as well, in his post about non-fiction footnotes in ebooks - he’s actually complaining about footnotes being a relic from the days of printed text, but I’m a fan of the printed form at least. I like a giant list of references and notes to work your way through, or to refer back to.
I write almost exclusively in markdown nowadays and I’m used to the square-bracket-round-bracket way of linking; [here's an example](http://example.com)
, but you can also link in Reference Style like this:
In a hole in the ground there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends
of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to
eat: it was a [hobbit-hole][1], and that means comfort.
[1]: <https://en.wikipedia.org/wiki/Hobbit#Lifestyle> "Hobbit lifestyles"
You get a nice list of links at the end of your writing, as well as the overall piece being easier on the eye to read. I think I first encoutered reference style links via Stack Overflow in their editor:
This blog is made in Jekyll which has a really nice plugin architecture, and after my first successful bash making jekyll-lazy-gist-embedding plugin which was pretty much a straight copy of an existing plugin, I thought I’d have a go at producing one that can extract all the links in a post and then append them to the end of the article.
This piece from Starr Horne about generating subnavigation seemed to do the same kind of thing that I wanted - parse a post and store some data about it, for use by the liquid templates later.
Thanks to that, it was super easy to make jekyll-extract-links which you should see in action, at the very end of this post.
For each link in a post, the plugin saves the linking text, the full href and a tidied href, which has any campaign utm or Chrome deep text-fragment links removed, which can often make the URL pretty unreadable.
All links, in order of mention:
- Matt Webb: https://twitter.com/genmon
- printed QR codes in books: http://interconnected.org/home/2021/01/12/qr_codes
- Terence Eden: https://twitter.com/edent
- non-fiction footnotes in ebooks: https://shkspr.mobi/blog/2020/07/usability-of-footnotes/
- Reference Style: https://www.markdownguide.org/basic-syntax/#reference-style-links
- Stack Overflow: https://stackoverflow.com/
- Jekyll: https://jekyllrb.com/
- jekyll-lazy-gist-embedding plugin: /2021/01/14/jekyll-lazy-gist-embedding
- Starr Horne: https://twitter.com/starrhorne
- generating subnavigation: https://www.honeybadger.io/blog/automatically-generating-subnavigation-from-headings-in-jekyll/
- liquid templates: https://shopify.github.io/liquid/
- jekyll-extract-links: https://github.com/jaygooby/jekyll-extract-links
- campaign utm: https://support.google.com/analytics/answer/1033863
- Chrome deep text-fragment links: https://web.dev/text-fragments/
Recent posts:
- Patch for aarch64 (aka arm64) openssl 1.0.2 'relocation R_AARCH64_PREL64 against symbol OPENSSL_armcap_P error'
- TIL: the `NO_COLOR` informal standard to suppress ANSI colour escape codes
- Copy the contents of a branch into an existing git branch without merging
- Adding search to a static Jekyll site using pagefind
- asdf, python and automatically enabling virtual envs