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) {