diff options
| author | XhmikosR <[email protected]> | 2023-08-06 09:40:35 +0300 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2024-03-05 20:34:45 +0200 |
| commit | 688d7e352a3c6370d7aa1871c0bb1d461af6a8e7 (patch) | |
| tree | 32cf1279f79e0d76edf83d69e83c8c7a4d3983f1 | |
| parent | 87be2b9d24c60db1070b2241d7046fc002132a4e (diff) | |
| download | bootstrap-688d7e352a3c6370d7aa1871c0bb1d461af6a8e7.tar.xz bootstrap-688d7e352a3c6370d7aa1871c0bb1d461af6a8e7.zip | |
render-heading.html: use variables
| -rw-r--r-- | site/layouts/_default/_markup/render-heading.html | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/site/layouts/_default/_markup/render-heading.html b/site/layouts/_default/_markup/render-heading.html index cfb3d8fe7..d115f85dc 100644 --- a/site/layouts/_default/_markup/render-heading.html +++ b/site/layouts/_default/_markup/render-heading.html @@ -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 }}> |
