Use Hugo anchorize to sanitize titles. Resolves #301 (#302)

Signed-off-by: Pete Lumbis <pete@upbound.io>
This commit is contained in:
Pete Lumbis 2023-01-30 11:49:04 -05:00 committed by GitHub
parent 4b886caef9
commit 247efca59c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1,7 +1,7 @@
<!-- 2000 is the maxium Hugo seq length -->
{{ $randNum := index (seq 2000 | shuffle) 0 }}
{{ $title := .Get 0 | default "Expand"}}
{{ $id := (replaceRE "(\\s)" "" (printf "%s-%d" $title $randNum)) }}
{{ $id := (replaceRE "(\\s)" "" (printf "%s-%d" (anchorize $title) $randNum)) }}
<div class="accordion mb-3" id="{{$id}}-Parent">
<div class="accordion-item">
<h2 class="accordion-header" id="{{$id}}">