diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index 097aa0b940d93..eb256455b0878 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -49,10 +49,12 @@ window.currentCrate = getVar("current-crate");
function setMobileTopbar() {
// FIXME: It would be nicer to generate this text content directly in HTML,
// but with the current code it's hard to get the right information in the right place.
- const mobileLocationTitle = document.querySelector(".mobile-topbar h2");
+ const mobileTopbar = document.querySelector(".mobile-topbar");
const locationTitle = document.querySelector(".sidebar h2.location");
- if (mobileLocationTitle && locationTitle) {
- mobileLocationTitle.innerHTML = locationTitle.innerHTML;
+ if (mobileTopbar && locationTitle) {
+ const mobileTitle = document.createElement("h2");
+ mobileTitle.innerHTML = locationTitle.innerHTML;
+ mobileTopbar.appendChild(mobileTitle);
}
}
diff --git a/src/librustdoc/html/templates/page.html b/src/librustdoc/html/templates/page.html
index b4b9c31916532..579c782be0975 100644
--- a/src/librustdoc/html/templates/page.html
+++ b/src/librustdoc/html/templates/page.html
@@ -84,8 +84,7 @@
{# #}
{% endif %}
{# #}
-