diff options
| author | XhmikosR <[email protected]> | 2022-02-19 15:16:23 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-02-19 15:16:23 +0200 |
| commit | ae12d645ef0225831e59248c45689042ebdb83d2 (patch) | |
| tree | d875ad4a993a9fc74d6f01bb0cb71c7f122185f1 /site/layouts/_default/_markup/render-heading.html | |
| parent | 407af8ac7f9296627aebc1e4c5d0ee948f8be1f3 (diff) | |
| download | bootstrap-ae12d645ef0225831e59248c45689042ebdb83d2.tar.xz bootstrap-ae12d645ef0225831e59248c45689042ebdb83d2.zip | |
Replace AnchorJS with a Hugo render hook (#32953)
* Replace AnchorJS with a Hugo render hook
* docs(anchors): improve aria-label on anchor links
* docs(anchors): show anchor link when ed
* docs(anchors): add hash in pseudo-element
Co-authored-by: Gaƫl Poupard <[email protected]>
Diffstat (limited to 'site/layouts/_default/_markup/render-heading.html')
| -rw-r--r-- | site/layouts/_default/_markup/render-heading.html | 5 |
1 files changed, 5 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..cfb3d8fe7 --- /dev/null +++ b/site/layouts/_default/_markup/render-heading.html @@ -0,0 +1,5 @@ +<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} +{{- 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> +{{- end -}} +</h{{ .Level }}> |
