aboutsummaryrefslogtreecommitdiff
path: root/site/layouts/_default/_markup/render-heading.html
diff options
context:
space:
mode:
Diffstat (limited to 'site/layouts/_default/_markup/render-heading.html')
-rw-r--r--site/layouts/_default/_markup/render-heading.html7
1 files changed, 7 insertions, 0 deletions
diff --git a/site/layouts/_default/_markup/render-heading.html b/site/layouts/_default/_markup/render-heading.html
new file mode 100644
index 000000000..d115f85dc
--- /dev/null
+++ b/site/layouts/_default/_markup/render-heading.html
@@ -0,0 +1,7 @@
+{{- $id := .Anchor | safeURL -}}
+{{- $text := .Text | safeHTML -}}
+<h{{ .Level }} id="{{ $id }}">{{ $text }}
+{{- if and (ge .Level .Page.Site.Params.anchors.min) (le .Level .Page.Site.Params.anchors.max) }}{{" " -}}
+<a class="anchor-link" href="#{{ $id }}" aria-label="Link to this section: {{ $text }}"></a>
+{{- end -}}
+</h{{ .Level }}>