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.