Add carousel gallery shortcode

This commit is contained in:
2024-02-22 09:37:34 +00:00
parent 77f549c9a8
commit a7917968e2
7 changed files with 177 additions and 5 deletions

View File

@@ -2,10 +2,19 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
{{ if .Page.Store.Get "hasMermaid" }}
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: true });
</script>
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: true });
</script>
{{ end }}
{{ if .Page.Store.Get "hasCarousel" }}
{{ with resources.Get "js/bulma-carousel.min.js" }}
<script src="{{ .RelPermalink }}"></script>
{{ end }}
<script>
bulmaCarousel.attach('.carousel', { pagination: false });
</script>
{{ end }}
{{ $theme := resources.Get "js/theme.js" }}

View File

@@ -0,0 +1,7 @@
<!-- Start Carousel -->
<div class="carousel">
{{ .Inner }}
</div>
<!-- End Carousel -->
{{ .Page.Store.Set "hasCarousel" true }}

View File

@@ -3,6 +3,9 @@
{{ $img = $img.Resize (print (default "1264x" $width) " webp") }}
{{ $title := .Get "title" }}
{{ $class := .Get "class" }}
{{- with .Parent -}}
<div>
{{ end }}
<figure class="image{{ if $class }} {{ $class }}{{ end }}">
<img src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}" {{ if $title }}
alt="{{ $title }}" {{ end }}>
@@ -13,4 +16,7 @@
</small>
</figcaption>
{{ end }}
</figure>
</figure>
{{- with .Parent -}}
</div>
{{ end }}