#Emacs

Talking to the Wayback Machine

Way back in 2016, I migrated this site from its Publify incarnation to a static site generated from markdown files by Hugo. In that migration, I fucked up and truncated a buttload of posts and didn’t realise what I’d done until long after (about a week ago now) I had misplaced the database that the site had originally been generated from. Oops.

However, the Internet is still a marvellous place, blessed with useful sites like The Wayback Machine, which lets the interested reader browse historic versions of web pages. Which means, provided a page got noticed by archive.org’s crawlers, I can fetch a page from back before I fucked up and, with a little bit of massaging, turn it into something that Hugo can understand and get the whole article back again.

  • 2 likes
  • 1 repost
  • 0 replies
  • 1 mention

Written by Piers Cawley , updated

Read more…

@07:51

Progress!

Before:

./data/mentions/3f256ff[...]494.json
./data/mentions/62afe34[...]020.json
...

Hmm, so which file pertains to which post?

{{ $slug := .RelPermalink | sha256 }}
{{ $all_mentions := index site.Data.mentions $slug | default slice }}
{{ $likes := where $all_mentions "wm-property" "like-of" }}

At least the template code to get at it is more or less sane.

During:

./data/mentions/note/8/mentions.json
./data/mentions/note/9/mentions.json

Well, that’s clear as day!

{{ $key := (split path.Dir .RelPermalink) "/" | after 1 | append "mentions" }}
{{ $all_mentions := index site.Data.mentions $key | default slice }}
{{ $likes := where $all_mentions "wm-property" "like-of" }}

What the actual fuck? I want to write {{ index site.Data.mentions .RelPermalink }} and have done with it. To the data mungery!

Now

./data/mentions/all.json

That’s a tad more opaque, isn’t it? Ah well, there’s always jq. I can’t see what’s got new mentions from git status any more, but also, I can’t forget to add any new data files either. Call it a win on aggregate.

{{ $all_mentions = index site.Data.mentions.all .RelPermalink | default dict }}
{{ $likes := index $all_mentions "like-of" | default slice }}

Well structured data for the win! And I’m working on eliminating the annoying default dict and default slice in that too.

  • 1 like
  • 0 reposts
  • 0 replies
  • 2 mentions

@07:27

The pull of “One Big Text File” is strong

I’m semi-seriously contemplating pulling the Hugo theme that I use to generate this website into a single Org file and using Org’s Literate Programming tooling to spit it out into individual layout files.

I may need an intervention.

  • 3 likes
  • 0 reposts
  • 0 replies
  • 0 mentions