Add menu_style site param

master
Will Faught 3 years ago
parent d1003a5bc6
commit 0dca2ca51a

@ -233,6 +233,7 @@ paige:
date_format: "2006 January 2" # Hugo date format for page dates
hide_theme_comment: true # Don't put a link to this project in a code comment
hide_theme_link: true # Don't put a link to this project in the footer
menu_style: "links" # Menu is link list for "links", tab list for "tabs", or pill list if unset
rss:
managing_editor: "Michael Bluth"
web_master: "Michael Bluth"

@ -3,11 +3,25 @@
{{ if eq $basePath "/" }}
{{ $basePath = "" }}
{{ end }}
<nav class="justify-content-center my-3 nav nav-pills">
{{ $links := false }}
{{ $pills := false }}
{{ $tabs := false }}
{{ with .Site.Params.paige.menu_style }}
{{ if eq . `links` }}
{{ $links = true }}
{{ else if eq . `tabs` }}
{{ $tabs = true }}
{{ else }}
{{ $pills = true }}
{{ end }}
{{ else }}
{{ $pills = true }}
{{ end }}
<nav class="justify-content-center my-3 nav{{ if $pills }} nav-pills{{ else if $tabs }} nav-tabs{{ end }}">
{{ range .Site.Menus.main }}
{{ $pagePath := strings.TrimPrefix $basePath $p.RelPermalink }}
{{ $menuPath := strings.TrimPrefix $basePath .URL }}
{{ $active := or (and (eq $menuPath `/`) (eq $pagePath `/`)) (and (ne $menuPath `/`) (hasPrefix $pagePath $menuPath)) }}
<a href="{{ .URL }}" class="nav-link{{ if $active }} active{{ end }}"{{ if $active }} aria-current="page"{{ end }}>{{ .Name }}</a>
<a href="{{ .URL }}" class="nav-link{{ if $active }} active{{ if $links }} link-secondary{{ end }}{{ end }}"{{ if $active }} aria-current="page"{{ end }}>{{ .Name }}</a>
{{ end }}
</nav>

Loading…
Cancel
Save