@16:30
Further to my last note, I think I might have a working script to send webmentions for any updated pages. Now to plumb it into the rest of the automation!
#!/usr/bin/env emacs -script
is a powerful drug!
The personal website of Piers Cawley
(they/him)
—
FolkSinger, photographer, carer and occasional programmer.
Further to my last note, I think I might have a working script to send webmentions for any updated pages. Now to plumb it into the rest of the automation!
#!/usr/bin/env emacs -script
is a powerful drug!
Now I can display received Webmentions, I need to start working on sending them.
I don’t want to rely on an external service if I can help it, because that’s how my old setup decayed, so don’t hold your breath.
But the output of rsync --itemize-changes ...
is looking tasty as a mechanism for spotting which URLs have changed between deployment runs.
Time to start experimenting.
Hmm… the first experiment doesn’t look too promising.
All being well, this note was deployed here by a cron job, and all the webmentions data got updated too.
All being well…
Oh! The reason Hugo didn’t load data/mentions.json
was that the directory data/mentions/
exists!
Moved the webmentions data to data/webmentions.json
and all is fine.
In which we finish with Webmentions for the time being by massaging a flat list of mentions into a two-level hash table/JSON object that’s easy to make use of in Hugo.
And speculate about how we could improve things further, because things can always be improved.
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.
Cory Doctorow has an axe to grind.
Cory always has an axe to grind, of course, but since the upshot of that is books like Picks and Shovels, then I’m okay with that.
This is the third Marty Hench thriller and it’s a cracking read
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.
I’ve reinstated webmention processing here and have semi-automated it with a pile of Emacs Lisp and a Makefile
, so I thought I’d write up some of the gory details.
Part 1 of… some?
Yay! Kicking it old school with a Makefile
to automate building and deploying this site. I don’t know if I can entrust it to a cron job yet because the deployment involves ssh, and I’m a bit fuzzy on the workings of key management in such circumstances
I think I have webmentions displaying correctly again. However, we’re updating everything manually again at the moment, at least until I get a webhook up and running again, so it might take a while for your replies, reposts &c. to show up on the site.
Still, it does appear to be working again.
This is absolutely what a sane person might write in their blog, isn’t it?
#+begin_example
,#+begin_src emacs-lisp :tangle nil :noweb-ref bibble
#+end_example
#+begin_src emacs-lisp
(setq some-variable 'some-value)
#+end_src
#+begin_example
,#+end_src
#+end_example
And then doing this to their CSS to make it work
.highlight+.highlight {
margin-top: 0;
}
I’m going to hell, aren’t I?
For bonus points, see if you can work out what’s actually written in the source file for this note.
I really should get around to replacing bloody GitHub.
God help me if I end up self-hosting my own instance of some code forge, but AI bollocks can fuck right off. I keep hoping that people are going to wake up and realise it’s the very worst kind of emperor’s new clothes bullshit, but they’re taking their own sweet time about it.
I confess that the blog is implying that it works with webmentions, but the infrastructure I used to display them isn’t working at the moment. Fixing it’s on the long TODO list that I might never get around to. However, the service that catches any webmentions is still in operation, so I’m not keen to remove it entirely.
Maybe I need to bump fixing things up the priority list.
I spent a few hours reducing a small annoyance related to the way I use Emacs to maintain its literate configuration file by incrementally implementing slightly better processes until I reached the point where it was Good Enough to spend several more hours writing it up for the blog.
Not an elevator pitch for Emacs.