mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
✨ Feat: add page param decreaseH1 to decrease the H1 heading level in content
This commit is contained in:
@@ -1070,6 +1070,8 @@ mainSections = []
|
||||
ordered = false
|
||||
startLevel = 2
|
||||
endLevel = 6
|
||||
# FixIt 0.4.0 | NEW whether to decrease the H1 heading level in content
|
||||
decreaseH1 = false
|
||||
# FixIt 0.2.13 | NEW Display a message at the beginning of an article to warn the reader that its content might be expired
|
||||
[params.page.expirationReminder]
|
||||
enable = false
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
{{- $h5Format := $headingConfig.number.format.h5 | default "{h2}.{h3}.{h4}.{h5} {title}" -}}
|
||||
{{- $h6Format := $headingConfig.number.format.h6 | default "{h2}.{h3}.{h4}.{h5}.{h6} {title}" -}}
|
||||
{{- $level := .Level -}}
|
||||
{{- $maxMarkupLevel := 2 -}}
|
||||
{{- $maxMarkupLevel := cond $toc.decreaseH1 2 1 -}}
|
||||
|
||||
{{- /* Disable ordered headings on home page */ -}}
|
||||
{{- if eq hugo.Context.MarkupScope "home" -}}
|
||||
@@ -45,8 +45,9 @@
|
||||
{{- $attrs = partial "function/trim.html" $attrs -}}
|
||||
|
||||
{{- /* Force decrease the markup level to avoid multiple h1 */ -}}
|
||||
{{- $markupLevel := cond (gt $maxMarkupLevel $level) $maxMarkupLevel $level -}}
|
||||
<h{{ $markupLevel }} {{ $attrs | safeHTMLAttr }}>
|
||||
{{- $decreased := gt $maxMarkupLevel $level -}}
|
||||
{{- $markupLevel := cond $decreased $maxMarkupLevel $level -}}
|
||||
<h{{ $markupLevel }} {{ $attrs | safeHTMLAttr }}{{ with $decreased }} data-decreased{{ end }}>
|
||||
{{- $title := .Text -}}
|
||||
{{- if $ordered -}}
|
||||
{{- /* Add 1 to the current level */ -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{- hugo.Store.Set "version" "v0.4.0-alpha-20250814132913-e04bb611" -}}
|
||||
{{- hugo.Store.Set "version" "v0.4.0-alpha-20250817071316-77fcd7fa" -}}
|
||||
{{- .Store.Set "this" dict -}}
|
||||
|
||||
{{- partial "init/detection-env.html" . -}}
|
||||
|
||||
Reference in New Issue
Block a user