mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
✨ Feat: add hugo.mainSections param support (#590)
https://gohugo.io/methods/site/mainsections/
This commit is contained in:
@@ -34,6 +34,8 @@ enableRobotsTXT = true
|
||||
enableGitInfo = true
|
||||
# whether to use emoji code
|
||||
enableEmoji = true
|
||||
# the main sections of a site
|
||||
mainSections = []
|
||||
|
||||
# -------------------------------------------------------------------------------------
|
||||
# Menu Configuration
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
{{- end -}}
|
||||
{{- $headingConfig := $params.heading -}}
|
||||
{{- /* Only enable in main section pages */ -}}
|
||||
{{- $onlyMainSection := cond $headingConfig.number.onlyMainSection (eq .Page.Type "posts") true -}}
|
||||
{{- $intersect := (slice .Page.Section .Page.Type) | intersect site.MainSections -}}
|
||||
{{- $onlyMainSection := cond $headingConfig.number.onlyMainSection ((gt (len $intersect) 0) | and (eq .Page.Kind "page")) true -}}
|
||||
{{- $ordered := $toc.ordered | and $headingConfig.number.enable | and $onlyMainSection -}}
|
||||
{{- $h1Format := $headingConfig.number.format.h1 | default "{title}" -}}
|
||||
{{- $h2Format := $headingConfig.number.format.h2 | default "{h2} {title}" -}}
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
{{- $homeRelPermalink = strings.TrimSuffix "offline/" $homeRelPermalink -}}
|
||||
{{- .Scratch.Set "homeRelPermalink" $homeRelPermalink -}}
|
||||
|
||||
{{- /* Set pages of main section */ -}}
|
||||
{{- $pages := where .Site.RegularPages "Type" "posts" -}}
|
||||
{{- /* Set pages of main sections */ -}}
|
||||
{{- $pages := where .Site.RegularPages "Section" "in" .Site.MainSections -}}
|
||||
{{- $pages = $pages | union (where .Site.RegularPages "Type" "in" .Site.MainSections) -}}
|
||||
{{- .Scratch.Set "mainSectionPages" $pages -}}
|
||||
|
||||
{{- /* Select the scope named `public_repo` to generate personal access token */ -}}
|
||||
|
||||
Reference in New Issue
Block a user