diff --git a/layouts/simplecss/templates/layout_main.html b/layouts/simplecss/templates/layout_main.html index 4aa5199..d3d27bd 100644 --- a/layouts/simplecss/templates/layout_main.html +++ b/layouts/simplecss/templates/layout_main.html @@ -13,6 +13,13 @@

{{ .Site.Title }}

{{ .Site.Tagline }}

+ {{ if .Site.NavItems }} + + {{ end }}
diff --git a/models/pubmodel/sites.go b/models/pubmodel/sites.go index 38ba614..9f25b2f 100644 --- a/models/pubmodel/sites.go +++ b/models/pubmodel/sites.go @@ -6,6 +6,7 @@ import ( "iter" "lmika.dev/lmika/weiro/models" + "lmika.dev/pkg/modash/moslice" ) type Site struct { @@ -20,3 +21,7 @@ type Site struct { CategoriesOfPost func(ctx context.Context, postID int64) ([]*models.Category, error) Pages []*models.Page } + +func (s Site) NavItems() []*models.Page { + return moslice.Filter(s.Pages, func(p *models.Page) bool { return p.ShowInNav }) +}