diff --git a/hugo.toml b/hugo.toml index b2cc6ca5..3662eaba 100644 --- a/hugo.toml +++ b/hugo.toml @@ -698,6 +698,8 @@ enableEmoji = true [params.page.heading.number] # whether to enable auto heading numbering enable = false + # FixIt 0.3.3 | NEW only enable in main section pages (default is posts) + onlyMainSection = true [params.page.heading.number.format] h1 = "{title}" h2 = "{h2} {title}" diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html index 86760cf6..26d0a4a4 100644 --- a/layouts/_default/_markup/render-heading.html +++ b/layouts/_default/_markup/render-heading.html @@ -15,7 +15,10 @@ - {{- if $params.heading.number.enable -}} + + {{- /* Only enable in main section pages */ -}} + {{- $onlyMainSection := cond $params.heading.number.onlyMainSection (eq .Page.Type "posts") true -}} + {{- if $params.heading.number.enable | and $onlyMainSection -}} {{- /* Add 1 to the current level */ -}} {{- $headingMap := .Page.Scratch.Get "heading-counter" -}} {{- $count := (string .Level) | index $headingMap | int | add 1 -}}