Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add parameter to empty sidebar on mobile #287

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions exampleSite/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ params:
# full (100%), wide (90rem), normal (1280px)
width: normal

sidebar:
emptyMobile: false

theme:
# light | dark | system
default: system
Expand Down
2 changes: 2 additions & 0 deletions layouts/partials/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
{{ partial "search.html" }}
</div>
<div class="hextra-scrollbar overflow-y-auto overflow-x-hidden p-4 grow md:h-[calc(100vh-var(--navbar-height)-var(--menu-height))]">
{{- if not site.Params.sidebar.emptyMobile -}}
<ul class="flex flex-col gap-1 md:hidden">
<!-- Nav -->
{{ template "sidebar-main" (dict "context" site.Home "pageURL" $pageURL "page" $context "toc" true) -}}
{{ template "sidebar-footer" }}
</ul>
{{- end -}}

<!-- Sidebar on large screen -->
{{- if $disableSidebar -}}
Expand Down