hugo-theme-termlite/layouts/_default/_markup/render-heading.html
Eryn Wells 576e7cb485 Allow disabling header anchors with page and element params
Set params.renderHeadingAnchors = false to disable for a whole page.
Set the element attribute anchor = false to disable for a single heading.
2024-07-06 10:18:51 -07:00

8 lines
386 B
HTML

<h{{ .Level }} id="{{ .Anchor }}" class="heading">
{{ .Text | safeHTML }}
{{- $pageWantsAnchors := .Page.Params.renderHeadingAnchors | default true -}}
{{- $anchorEnabledForThisHeading := .Attributes.anchor | default true -}}
{{- if and $pageWantsAnchors $anchorEnabledForThisHeading -}}
<a class="heading__anchor" href="#{{ .Anchor }}">#</a>
{{- end -}}
</h{{ .Level }}>