diff --git a/static/js/app.js b/static/js/app.js index 29444e5..a784093 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -508,6 +508,9 @@ const newContent = doc.getElementById('content'); const oldContent = document.getElementById('content'); + // Read the marker off newContent — replaceWith() reparents that node into + // the live document, so `doc` no longer contains it afterwards. + const openSlug = newContent?.querySelector('[data-open-slug]')?.dataset.openSlug || null; if (newContent && oldContent) oldContent.replaceWith(newContent); const newData = doc.getElementById('roux-data'); @@ -515,8 +518,6 @@ try { POSTS = JSON.parse(newData.textContent) || []; lbBuilt = false; } catch {} } - const openSlug = doc.querySelector('[data-open-slug]')?.dataset.openSlug || null; - document.title = doc.title; syncHeadMeta(doc); if (push) history.pushState({ url: abs, slug: openSlug || undefined }, '', abs);