From aef6f59ee12c208871b3a6a164fad79623a5790c Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Fri, 27 Oct 2023 22:31:04 +0200 Subject: [PATCH] fix!: generate unique properties anchor (#457) The way anchors are generated for `properties` of a `propertylist` has changed to be unique, even if the shortcode is used multiple times on a page. --- exampleSite/content/posts/advanced/shortcodes.md | 2 +- layouts/shortcodes/propertylist.html | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/exampleSite/content/posts/advanced/shortcodes.md b/exampleSite/content/posts/advanced/shortcodes.md index 0283ee7..7b7ff91 100644 --- a/exampleSite/content/posts/advanced/shortcodes.md +++ b/exampleSite/content/posts/advanced/shortcodes.md @@ -528,7 +528,7 @@ The supported attributes can be taken from the following example: -{{< propertylist name=shortcode-buttons sort=name order=asc >}} +{{< propertylist name=shortcode-propertylist sort=name order=asc >}} diff --git a/layouts/shortcodes/propertylist.html b/layouts/shortcodes/propertylist.html index 090e941..8a1d485 100644 --- a/layouts/shortcodes/propertylist.html +++ b/layouts/shortcodes/propertylist.html @@ -11,7 +11,8 @@ {{- $properties = (sort $properties . $order) }} {{- end }} {{- range $properties }} -
+ {{- $uniqueAnchor := anchorize (printf "%s-%s" $name .name) | safeHTML }} +
{{ .name }} {{- if .required }} required @@ -28,7 +29,7 @@ {{- end }} {{- end }} {{- if $showAnchor }} - + {{- end }}