Merge pull request #921 from nunocoracao/886-adding-gallery-shortcode-to-multiple-timeline-items-breaks-lay-out

🐛 updated logic for unique ids in shortcodes
This commit is contained in:
Nuno Coração 2023-08-17 22:02:57 +01:00 committed by GitHub
commit 55bb0db3ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 6 deletions

View file

@ -1,5 +1,4 @@
{{ $time := now.UnixNano }}
{{ $id := delimit (slice "gallery" $time) "-" }}
{{ $id := delimit (slice "carousel" .Ordinal now.UnixNano) "-" }}
{{ $aspect := default "16-9" (.Get "aspectRatio") }}
{{ $images := .Page.Resources.Match (.Get "images") }}
{{ $interval := default "2000" (.Get "interval") }}

View file

@ -1,5 +1,5 @@
{{ $id := delimit (slice "chart" .Ordinal now.UnixNano) "-" }}
<div class="chart">
{{ $id := delimit (shuffle (seq 1 9)) "" }}
<canvas id="{{ $id }}"></canvas>
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", (event) => {

View file

@ -1,4 +1,4 @@
{{ $id := delimit (slice "gallery" .Ordinal) "-" }}
{{ $id := delimit (slice "gallery" .Ordinal now.UnixNano) "-" }}
<div id="{{ $id }}">
{{ .Inner }}

View file

@ -13,8 +13,7 @@
{{- end -}}
{{- $tag := .Get "tag" | default "div" -}}
{{ $time := now.UnixNano }}
{{ $id := delimit (slice "typeit" $time) "-" }}
{{ $id := delimit (slice "typeit" .Ordinal now.UnixNano) "-" }}
{{- $attrs := printf `id="%v"` $id -}}
{{- with $classList -}}