I've made posting here with a companion thread on PopsicleBoat automatic
I have had scripts to make things easier for a while, but I’m writing now because I’ve wired them all together to make posting here with a companion PopsicleBoat comment thread easier than ever.
Press the button, it's printed. Not on paper but you get what I mean. Complete with a companion comments thread on PopsicleBoat.
It’s basically one script with a few prompts. (I used it to create this post, for instance):
scripts/new-post
Title: I've made posting here with a companion thread on PopsicleBoat automatic
Slug [ive-made-posting-here-with-a-companion-thread-on-popsicleboat-automatic]:
Media for this post (scaffolds a page bundle)? [Y/n]: y
Description (meta/OG line; blank to fill in later): Automatic comment section for any new blog post here
Summary (list-page line; blank to fill in later): I have scripts in place to start a fully connected blog post, complete with a companion comments section on PopsicleBoat
Categories, comma-separated [Projects]: Projects
Tags, comma-separated (e.g. popsicleboat, hugo): popsicleboat, hugo
Created content/weblog/ive-made-posting-here-with-a-companion-thread-on-popsicleboat-automatic/index.md — write the essay.
Committing it will prompt for its companion thread (empty space answer skips).
I’ll commit in a moment, and then name the companion thread. I (and you, if you’re reading) will see the result.
The main point of this is to demonstrate how easy it could be for you too, if you want it.
Most of each is YAML quoting and error handling. The two bits are the actual idea.
The scaffold defaults to a Hugo page bundle, so a post always has somewhere to put images:
read -r -p "Media for this post (scaffolds a page bundle)? [Y/n]: " bundle
case $bundle in
[nN]*) post="content/weblog/$slug.md" ;;
*) post="content/weblog/$slug/index.md" ;;
esac
And the commit hook re-stages the post after wiring the thread URL into it, which is why the thread arrives in the same commit instead of a follow-up:
if scripts/companion-thread "$post"; then
git add "$post"
fi
One caveat if you want to copy this: it leans on three things I set up once and forgot about. A POPSICLEBOAT_TOKEN in my shell, a companion-thread.template.md written in my own words that the command fills in per post, and scripts/setup having turned the git hooks on. Without those the scaffold still works, the hook just shrugs and tells you to wire the thread later.
Worth admitting: writing this post broke the tooling it describes. Pasting the scaffold script in dragged along the review marker from its own comments, and the gate that keeps unreviewed copy off the site saw it and blocked the commit. Nothing to rewrite, the marker was the subject. The gate ignores fenced code now.