diff --git a/docs/javascripts/extra.js b/docs/javascripts/extra.js index cb44c1b..d3adc8b 100644 --- a/docs/javascripts/extra.js +++ b/docs/javascripts/extra.js @@ -80,6 +80,29 @@ function boot() { initScrollReveal(); initCursorGlow(); + initCusdisReload(); + } + + /** + * Re-initialize Cusdis comment widget after Zensical instant-navigation + * page transitions (XHR-based SPA navigation). Without this, the widget + * only renders on hard-refresh / initial page load. + */ + function initCusdisReload() { + if (typeof document$ === "undefined") return; // not in Zensical context + + document$.subscribe(function () { + var el = document.getElementById("cusdis_thread"); + if (!el) return; + + // Clear stale Cusdis iframe from previous page render + el.innerHTML = ""; + + // Re-create Cusdis widget for the new page + if (window.CUSDIS && typeof window.CUSDIS.renderTo === "function") { + window.CUSDIS.renderTo(el); + } + }); } if (document.readyState === "loading") { diff --git a/overrides/partials/comments.html b/overrides/partials/comments.html index a763acb..9248487 100644 --- a/overrides/partials/comments.html +++ b/overrides/partials/comments.html @@ -1,4 +1,3 @@ -{% if page.meta.comments %}

{{ lang.t("meta.comments") }}

- -{% endif %} \ No newline at end of file + \ No newline at end of file