From b365a03e715d01b38418751f002c90faca1b587d Mon Sep 17 00:00:00 2001 From: Svilen Markov <7613769+svilenmarkov@users.noreply.github.com> Date: Mon, 5 Aug 2024 12:42:41 +0100 Subject: [PATCH] Allow hiding desktop navigation --- docs/configuration.md | 4 ++++ internal/assets/templates/page.html | 2 ++ internal/glance/glance.go | 13 +++++++------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 0681386..478cdcd 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -265,6 +265,7 @@ pages: | title | string | yes | | | slug | string | no | | | width | string | no | | +| hide-desktop-navigation | boolean | no | false | | show-mobile-header | boolean | no | false | | columns | array | yes | | @@ -286,6 +287,9 @@ The maximum width of the page on desktop. Possible values are `slim` and `wide`. > When using `slim`, the maximum number of columns allowed for that page is `2`. +#### `hide-desktop-navigation` +Whether to show the navigation links at the top of the page on desktop. + #### `show-mobile-header` Whether to show a header displaying the name of the page on mobile. The header purposefully has a lot of vertical whitespace in order to push the content down and make it easier to reach on tall devices. diff --git a/internal/assets/templates/page.html b/internal/assets/templates/page.html index b3a7b56..88e3c3a 100644 --- a/internal/assets/templates/page.html +++ b/internal/assets/templates/page.html @@ -26,6 +26,7 @@ {{ define "document-body" }}
+ {{ if not .Page.HideDesktopNavigation }}
@@ -35,6 +36,7 @@
+ {{ end }}
diff --git a/internal/glance/glance.go b/internal/glance/glance.go index 9d854a0..21e56bb 100644 --- a/internal/glance/glance.go +++ b/internal/glance/glance.go @@ -58,12 +58,13 @@ type templateData struct { } type Page struct { - Title string `yaml:"name"` - Slug string `yaml:"slug"` - Width string `yaml:"width"` - ShowMobileHeader bool `yaml:"show-mobile-header"` - Columns []Column `yaml:"columns"` - mu sync.Mutex + Title string `yaml:"name"` + Slug string `yaml:"slug"` + Width string `yaml:"width"` + ShowMobileHeader bool `yaml:"show-mobile-header"` + HideDesktopNavigation bool `yaml:"hide-desktop-navigation"` + Columns []Column `yaml:"columns"` + mu sync.Mutex } func (p *Page) UpdateOutdatedWidgets() {