mirror of
https://github.com/nikdoof/website-hugo.git
synced 2025-12-14 11:32:26 +00:00
Add carousel gallery shortcode
This commit is contained in:
@@ -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" }}
|
||||
|
||||
7
themes/lhs/layouts/shortcodes/gallery.html
Normal file
7
themes/lhs/layouts/shortcodes/gallery.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<!-- Start Carousel -->
|
||||
<div class="carousel">
|
||||
{{ .Inner }}
|
||||
</div>
|
||||
<!-- End Carousel -->
|
||||
|
||||
{{ .Page.Store.Set "hasCarousel" true }}
|
||||
@@ -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 }}
|
||||
Reference in New Issue
Block a user