From 77d76f1d7fcfa45836fb61347f4975c193d79894 Mon Sep 17 00:00:00 2001 From: gator Date: Wed, 9 Sep 2026 02:01:08 +0000 Subject: [PATCH] Share the page that has preview tags, not the JavaScript route MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Preview crawlers do not run JavaScript, so the /v/ route — which is the home page plus a client-side redirect — gives them nothing. The published /v/.html page carries real og:image, og:video and a real video element in the served source. Five characters longer, and the difference between a card someone taps and a bare grey link. --- videos.html | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/videos.html b/videos.html index 4565c28..49f4775 100644 --- a/videos.html +++ b/videos.html @@ -113,9 +113,24 @@ async function load() { if (!p) return; var link = window.__shareUrl(p); if (!link) { showMsg("msg", "That one has no video yet."); return; } - // Sharing is a decision: this is what makes the link resolve at all. - var s = await api("share_link", { email: email, project_id: p.id }); - if (!s.ok) { showMsg("msg", s.error || "Could not make a link."); return; } + // Publish the static page first: it is what carries the preview tags, + // and crawlers never run the JavaScript route. + b.disabled = true; b.textContent = "Preparing…"; + var s = await api("publish_share_page", { email: email, project_id: p.id }); + if (s.ok && s.pending) { + var waited = 0; + s = await new Promise(function (done) { + var t = setInterval(async function () { + waited += 4; + var g = await api("publish_share_page", { email: email, project_id: p.id }); + if (g.ok && !g.pending) { clearInterval(t); done(g); return; } + if (waited > 180) { clearInterval(t); done({ ok: false, error: "That is taking unusually long." }); } + }, 4000); + }); + } + b.disabled = false; b.textContent = "Share"; + if (!s.ok) { showMsg("msg", s.error || "Could not prepare that link."); return; } + if (s.note) { showMsg("msg", s.note); return; } link = s.url || link; var title = p.title || ((p.pet_name || "Your pet") + " has something to say"); // The native sheet is the shortest path into a text message on a phone.