From ba9a9dc9c41c3a937ec540bc19d7404ada9c6be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Tue, 16 Jun 2026 10:03:08 +0200 Subject: [PATCH] Update page title, URL and meta when navigating between lightbox slides goToSlide() now calls history.replaceState + updates document.title, description, og:title/description/url and canonical on each slide change. replaceState is used so swipe/keyboard navigation doesn't pollute history. Co-Authored-By: Claude Sonnet 4.6 --- static/js/app.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/static/js/app.js b/static/js/app.js index 0a5b719..06bd9e5 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -297,9 +297,22 @@ if (lbIndex) { lbIndex.innerHTML = `${String(lbIdx + 1).padStart(3,'0')} / ${lbList.length}`; } - lbBuildMeta(lbList[lbIdx]); + const p = lbList[lbIdx]; + lbBuildMeta(p); syncThumbs(); preloadNeighbors(lbIdx); + if (p && smooth) { + const postTitle = p.title + ' — Roux'; + const postUrl = new URL(p.url, location.origin).href; + document.title = postTitle; + history.replaceState({ slug: p.slug }, '', p.url); + setMeta('name', 'description', p.description || null); + setMeta('property', 'og:title', postTitle); + setMeta('property', 'og:description', p.description || null); + setMeta('property', 'og:url', postUrl); + const canon = document.querySelector('link[rel="canonical"]'); + if (canon) canon.href = postUrl; + } } function preloadNeighbors(idx) {