Skip to content

./blog.sh 1.12

Latest

Choose a tag to compare

@DanielSnor DanielSnor released this 21 Nov 15:59
1a8565f

./blog.sh 1.12 — the translation release.

A site in two languages has meant writing every post twice. 1.12 hands the second one to a machine and keeps the author in charge of it: translate --auto asks a translator the author names for a first draft, checks it against the original, and leaves it in a file to read, mend and save. Nothing is saved or published that nobody has read. Beside that, a reader can answer a toot from their own Mastodon server, and a post is announced only once its page is live. Much of it was asked for by Pavel, on pavelchcepsat.cz — thank you, Pavel. Nothing to migrate — but hashtags change their shape, and a site with no deploy target is no longer announced.

A first draft from a translator. ./blog.sh translate <slug> --lang de --auto sends the post and writes the answer into tmp/, with edits:, base: and lang: in its header; add saves it through the same door a text from the apps uses, so a post that changed in the meantime is refused, not overwritten. At the terminal a language with nothing written offers [a], and the editor opens on the machine's text with what looked wrong as // notes. The apps get it too: translate --json says whether a translator is there, and translate --auto --json returns the draft and its warnings without saving. There is no --publish, on purpose. (#68, #69)

Any translator, set in one place. The translator is a setting in env.sh, never in site.yml, which travels with the site. TRANSLATOR_COMMAND names any program that reads the post on standard input and writes the translation out — claude -p, a Gemini or Codex command line, ollama run, a script of one's own. Or TRANSLATOR= names a service: openai (and with TRANSLATOR_URL anything that speaks its API — Mistral, OpenRouter, Ollama, LM Studio), anthropic, gemini, deepl or libretranslate, with a model and a key. DeepL and LibreTranslate take no instructions, so the post goes paragraph by paragraph, with code, addresses and the Markdown itself kept aside where the service cannot touch them. ./setup.sh --translator asks about it and nothing else, and doctor says whether what is set is whole. Plain Net::HTTP, no gem.

Checked, not trusted. A translation is compared with its original: web addresses, names of pictures, numbers, and the count of headings, paragraphs and //--more--// lines. A difference is a warning, not a refusal. An answer that ran out of room, came back empty or was declined is not saved. What a provider says when it will not — a key it does not accept, no credit, a model the plan leaves out, too many requests — is said as what it is, with the setting to change. A key goes over https or to this machine only and never appears in what the engine says, and the translator program is not handed the engine's own secrets from env.sh. The grammar is the model's: no check of the engine can see a noun in the wrong case, so read a translation before saving it.

A paired device may ask for one. The apps are where most of the writing happens, so a phone may ask the server for a translation — unless env.sh says TRANSLATOR_REMOTE=deny. A translation is paid for by someone: a lost device can have them made until its key is revoked with ./blog.sh pair --revoke.

Reply from your own server. "Reply on Mastodon" opens the toot on the blog's instance, where most readers are not signed in. Beside it now, one field takes the reader's own server — mastodon.social, @me@mastodon.social, or an address copied from the bar — and opens the toot there, signed in, to reply, boost or favourite. The answer stays in the reader's browser, shared with the share button, and nothing about the reader reaches the site. On for every Mastodon post unless comments.reply_from_own_server: false. Classic, Terminal and the Minimal family lay it out. (#75)

Announced when the page is there. A post used to be announced before its page was deployed, so for as long as the build and the upload took, the link in the toot led to a 404 — and followers wrote to say so. Now the page goes out first, then the toot, then a second build puts the toot's address on the page. If the deploy fails, nothing is announced: the toot waits in .announce-pending, the next run of the publishing cron that gets a deploy through sends it, and doctor names what is waiting. A post renamed or moved meanwhile takes its debt along; a deleted one settles it. (#83)

Hashtags keep their words. A tag with a dot, a hyphen or a space was announced as a shorter one: blog.sh as #blog.sh, which Mastodon and Bluesky read as #blog; self-hosting as #self. Now a run of such characters is one _: #blog_sh, #self_hosting, #hudba_dana. C++ and C# are #Cplusplus and #Csharp, not both #C. A toot with many tags or a long title gives up tags from the end before Mastodon would refuse it, as on Bluesky.

Smaller things. add of a file that names a language but no edits: made an orphan post beside the original; it is refused. Saving one translation of a post no longer makes its other translation "changed". A translation just saved ends on its preview address and QR code, as a draft does. A list of posts cut at the 50 newest says so and how to reach the rest. The properties screen begins with the tags. [d] on a scheduled post reads the post again before saying it is still scheduled. Minimal Pictorial no longer cuts eight characters off a link's title. doctor says when the site's address has a path, a query or a fragment, when nano is really pico — as it is on macOS from 2026, where pico took a switch of GNU nano's for a file name and wrote the post into it; the engine opens it with -w now — and when the Ruby running the engine is missing a security fix — 3.2 and older get none, and GHSA-34m4-m9fh-gqp5 is fixed in 3.3.14, 3.4.13 and 4.0.10. Two review passes went over this release before the tag; what they found is fixed and pinned by a test that fails on the old code. (#79, #80, #81, #82)

Upgrading — git pull, rebuild, deploy. Nothing to migrate. The stylesheet and the comment script changed, so their fingerprints did, and the first deploy sends every page once — on a copy of sean.cz, 14,517 of its 14,670 built files, every one of them differing from 1.11.1 only in that fingerprint, the words of the reply field on a post with a toot, or the class of a link drawn by its address; the pictures stay where they are. New announcements go out under the new hashtags; toots already sent keep theirs. A site that serves public.nosync itself, with no deploy target set, is no longer announced by the cron or by publish — its page is on no server — and is announced by hand with ./blog.sh toot <slug> once it is. No translator is set up until you set one. And if you ever go back to 1.11.1, docs/install.md says what 1.12 leaves behind.

Full notes in CHANGELOG.md.

MIT licensed. Documentation · blogsh.app