]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
render-heading.html: use variables
authorXhmikosR <xhmikosr@gmail.com>
Sun, 6 Aug 2023 06:40:35 +0000 (09:40 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Tue, 5 Mar 2024 18:34:45 +0000 (20:34 +0200)
site/layouts/_default/_markup/render-heading.html

index cfb3d8fe79c38303a88160ad482ec58b2190d4a2..d115f85dcd39e2b52e6a04bd94b322c63f605f40 100644 (file)
@@ -1,5 +1,7 @@
-<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}
+{{- $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="#{{ .Anchor | safeURL }}" aria-label="Link to this section: {{ .Text | safeHTML }}"></a>
+<a class="anchor-link" href="#{{ $id }}" aria-label="Link to this section: {{ $text }}"></a>
 {{- end -}}
 </h{{ .Level }}>