Skip to content

Commit 16183e9

Browse files
humitosagjohnson
andauthored
Docs: handle versions when "instant loading" feature enabled (#12142)
Closes #12032 <!-- readthedocs-preview docs start --> --- :books: Documentation previews :books: - User's documentation (`docs`): https://docs--12142.org.readthedocs.build/12142/ <!-- readthedocs-preview docs end --> <!-- readthedocs-preview dev start --> - Developer's documentation (`dev`): https://dev--12142.org.readthedocs.build/12142/ <!-- readthedocs-preview dev end --> --------- Co-authored-by: Anthony <[email protected]>
1 parent ebf6d4d commit 16183e9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/user/intro/mkdocs.rst

+7
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ To integrate the :ref:`flyout-menu:Addons flyout menu` version menu into your si
158158
</ul>
159159
</div>`;
160160
161+
// Check if we already added versions and remove them if so.
162+
// This happens when using the "Instant loading" feature.
163+
// See https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/#instant-loading
164+
const currentVersions = document.querySelector(".md-version");
165+
if (currentVersions !== null) {
166+
currentVersions.remove();
167+
}
161168
document.querySelector(".md-header__topic").insertAdjacentHTML("beforeend", versioning);
162169
});
163170

0 commit comments

Comments
 (0)