Seven buttons under the title of every post and again after the text — the reader who decides on sight and the one who decides at the end are different people. Four are ordinary links and work with scripting off: WhatsApp, Facebook, Bluesky and Mastodon all take a URL that opens their own composer. The other three cannot be, and the reason is worth writing down rather than rediscovering: Signal has no web intent at all — it is a share target in the operating system's sheet and nowhere else — and Instagram accepts no link from anybody, by design, which is why every site with an Instagram share button is really offering a copied link. Both call navigator.share() where it exists and copy the address where it does not, beside a plain «Copiar enlace» that always works. Mastodon has no central address: the composer lives on whichever server the reader has an account on. It asks once, keeps the answer, and without scripting falls back to the association's own server. The icons are simplified marks in one visual language rather than the official logo files — reproducing those from memory gives something subtly wrong, and subtly wrong looks worse than plainly simple. Each carries its name for a screen reader and in `title` for a cursor. **And the half that was actually broken.** og:image pointed at the original upload: a photograph off a phone, two to five megabytes. WhatsApp fetches preview images on a tight budget and gives up on a file that size, so the card arrived as a title and a link with a blank where the picture should be. Hugo copies static/ and processes assets/, and only the second can be resized — so config.yaml mounts static/uploads and static/brand into assets/ as well, leaving every existing URL and everything the editor commits untouched, and seo-head.html now builds the card: 1200x630, filled from the middle, 93 KB measured against a 22 MB source. The logo fallback is fitted rather than filled and keeps its own format, because a wordmark cropped to a landscape card loses its ends and a transparent PNG turned into JPEG lands on a black square. og:image:width and :height go out with it, from the generated file so they cannot disagree with it. Several clients draw the small card rather than the large one when they would have to fetch the image to find out how big it is. Three guards, each verified by reintroducing its own bug: a button that needs the script says so in the markup; a hidden button is actually hidden (`[hidden]` is a user-agent rule and `display: inline-flex` beat it, so all seven showed and three did nothing); and every encoded link is marked safeURL, without which Go's escaper encoded it a second time and WhatsApp opened with %253A spelled out. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
24 lines
1.2 KiB
HTML
24 lines
1.2 KiB
HTML
{{/* The tags a share card needs to arrive with its picture.
|
|
|
|
One partial rather than the same five lines in three branches: the article,
|
|
the home page and a static page all share cards, and the set drifted once
|
|
already — the home page had no `twitter:image` for a while because it was
|
|
added to one branch and not the others.
|
|
|
|
Width and height are not decoration. Several clients draw the small card
|
|
instead of the large one when they would have to fetch the file to find
|
|
out how big it is, and WhatsApp in particular gives up on a slow or heavy
|
|
image rather than waiting for it. Both numbers come from the generated
|
|
card, so they cannot disagree with the file.
|
|
|
|
Takes: url, alt, width, height, type. */}}
|
|
{{ with .url }}
|
|
<meta property="og:image" content="{{ . }}">
|
|
<meta property="og:image:secure_url" content="{{ . }}">
|
|
{{ with $.alt }}<meta property="og:image:alt" content="{{ . }}">{{ end }}
|
|
{{ with $.width }}<meta property="og:image:width" content="{{ . }}">{{ end }}
|
|
{{ with $.height }}<meta property="og:image:height" content="{{ . }}">{{ end }}
|
|
{{ with $.type }}<meta property="og:image:type" content="{{ . }}">{{ end }}
|
|
<meta name="twitter:image" content="{{ . }}">
|
|
{{ end }}
|