aboutsummaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2023-05-18 11:03:37 -0400
committertdro <tdro@noreply.example.com>2023-05-18 11:03:37 -0400
commit180096c5cd723ab773d175545322280d8c1da93e (patch)
treed4ad331aa4e0fd0b36b52d405f710774c64a86a1 /themes
parentb68cfbceaea50a9b841b596b027ab202c3e7d909 (diff)
downloadcanory-180096c5cd723ab773d175545322280d8c1da93e.tar.gz
canory-180096c5cd723ab773d175545322280d8c1da93e.tar.bz2
canory-180096c5cd723ab773d175545322280d8c1da93e.zip
themes/default/layouts/_default/_markup/render-heading: Add more uniqueness
Diffstat (limited to 'themes')
-rw-r--r--themes/default/layouts/_default/_markup/render-heading.html11
1 files changed, 7 insertions, 4 deletions
diff --git a/themes/default/layouts/_default/_markup/render-heading.html b/themes/default/layouts/_default/_markup/render-heading.html
index 37eddb2..fdbe807 100644
--- a/themes/default/layouts/_default/_markup/render-heading.html
+++ b/themes/default/layouts/_default/_markup/render-heading.html
@@ -1,6 +1,9 @@
-<h{{ .Level }} id="{{ .Anchor | safeURL }}">
- <a
- title="{{ .Text | safeHTML }}"
- href="#{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}
+{{- $text := .Text -}}
+{{- $hash := print (truncate 8 "" (sha256 .Page.Permalink)) -}}
+{{- $id := print $hash "-" .Anchor -}}
+
+<h{{ .Level }} id="{{ $id | safeURL }}">
+ <a title="{{ $text | safeHTML }}" href="#{{ $id | safeURL }}">
+ {{ $text | safeHTML }}
</a>
</h{{ .Level }}>