hugo-theme-termlite/layouts/_default/_markup/render-heading.html

10 lines
507 B
HTML
Raw Normal View History

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