Skip to content

Commit

Permalink
feat: add option geekblogTagsToMenu (#73)
Browse files Browse the repository at this point in the history
Co-authored-by: Giovanni Ciatto <[email protected]>
  • Loading branch information
xoxys and gciatto authored Jul 6, 2021
1 parent 171feac commit ea976be
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions exampleSite/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ params:
geekblogPrivacyPolicy: https://thegeeklab.de/legal-notice/#privacy-policy

geekblogImageLazyLoading: true
geekblogTagsToMenu: true
3 changes: 3 additions & 0 deletions exampleSite/content/posts/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ enableGitInfo = true
# See https://developer.mozilla.org/de/docs/Web/HTML/Element/base.
geekblogOverwriteHTMLBase = false

# (Optional, default true) Enable or disable adding tags automatically to the main menu.
geekblogTagsToMenu = true

# (Optional, default none) Adds a "Hosted on <provider>" line to the footer.
# Could be used if you want to give credits to your hosting provider.
[params.geekblogHostedOn]
Expand Down
2 changes: 2 additions & 0 deletions layouts/partials/site-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
</div>
<ul class="gblog-nav__list container flex flex-wrap justify-center menu-content">
{{ $currentPage := .RelPermalink }}
{{ if default true .Site.Params.GeekblogTagsToMenu }}
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
{{ with $.Site.GetPage (printf "/tags/%s" $name) }}
<li>
<a class="gblog-nav__entry {{ if eq $currentPage .RelPermalink }} is-active {{ end }}" href="{{ .RelPermalink }}">{{ .Title }}</a>
</li>
{{ end }}
{{ end }}
{{ end }}
{{ if .Site.Data.menu.extra.header }}
{{ partial "menu-extra" (dict "current" . "source" .Site.Data.menu.extra.header "target" "header") }}
{{ end }}
Expand Down

0 comments on commit ea976be

Please sign in to comment.