Skip to content

Commit 3ed73f3

Browse files
authored
Merge pull request #315 from posit-dev/feat-improve-mobile-sidebar-btn
feat: improve mobile sidebar button appearance
2 parents e813d62 + c9d0e1b commit 3ed73f3

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

docs/scripts/post-render.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,4 +362,25 @@ def add_parens_to_functions(match):
362362
print(f"Index file not found: {index_file}")
363363

364364

365+
# Update quarto-secondary-nav-title to display "User Guide" text
366+
# This improves the mobile navigation by making it clear what the sidebar toggle reveals
367+
all_html_files = glob.glob("_site/**/*.html", recursive=True)
368+
print(f"Found {len(all_html_files)} HTML files to check for secondary nav title")
369+
370+
for html_file in all_html_files:
371+
with open(html_file, "r") as file:
372+
content = file.read()
373+
374+
# Replace empty h1.quarto-secondary-nav-title with h5 containing "User Guide"
375+
original_pattern = r'<h1 class="quarto-secondary-nav-title"></h1>'
376+
replacement = '<h5 class="quarto-secondary-nav-title">User Guide</h5>'
377+
378+
if original_pattern in content:
379+
print(f"Updating secondary nav title in: {html_file}")
380+
content = content.replace(original_pattern, replacement)
381+
382+
with open(html_file, "w") as file:
383+
file.write(content)
384+
385+
365386
print("Finished processing all files")

docs/styles.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,11 @@ a.sidebar-item-text.sidebar-link.text-start > span {
263263
background-position: 0% 50%;
264264
}
265265
}
266+
267+
/* Adjust mobile secondary nav positioning */
268+
@media (max-width: 991.98px) {
269+
#quarto-header .container-fluid.d-flex {
270+
margin-left: 0;
271+
padding-left: 5px;
272+
}
273+
}

0 commit comments

Comments
 (0)