2018-03-10 18:03:45 +01:00
|
|
|
{{/* USAGE: {{< sidebyside "gifv" "/path/to/src" "file1=caption" "file2=caption" >}} */}}
|
|
|
|
|
|
|
|
{{ $type := index .Params 0 }}
|
|
|
|
{{ $path := index .Params 1 }}
|
|
|
|
{{ $figures := after 2 .Params }}
|
2023-02-03 08:13:01 +01:00
|
|
|
{{ $originals := .Page.Resources }}
|
2018-03-10 18:03:45 +01:00
|
|
|
|
|
|
|
<div class="container" style="width: 100%;">
|
|
|
|
{{ $.Scratch.Set "size" (div 12 (len $figures)) }}
|
2020-05-22 16:23:47 +02:00
|
|
|
<div class="is-img-preview">
|
2018-03-10 18:03:45 +01:00
|
|
|
{{ range $figure := $figures }}
|
|
|
|
{{ $.Scratch.Set "src" (index (split $figure "=") 0) }}
|
|
|
|
{{ $.Scratch.Set "title" (index (split $figure "=") 1) }}
|
2019-08-17 22:50:53 +02:00
|
|
|
{{ $.Scratch.Set "link" (index (split $figure "=") 2) }}
|
2023-02-03 08:13:01 +01:00
|
|
|
{{ $resolved_path := $originals.GetMatch ($.Scratch.Get "src") }}
|
2018-03-10 18:03:45 +01:00
|
|
|
<div class="theme-table-image col-sm-{{ $.Scratch.Get "size" }}">
|
|
|
|
<figure style="padding: 0px;">
|
|
|
|
{{ if eq $type "gifv" }}
|
|
|
|
<div class="embed-responsive embed-responsive-4by3">
|
|
|
|
<video class="embed-responsive-item" preload="auto" autoplay="autoplay" muted="muted" loop="loop" webkit-playsinline="">
|
2023-02-03 08:13:01 +01:00
|
|
|
<source src="{{ $resolved_path.RelPermalink }}" type="video/mp4">
|
2018-03-10 18:03:45 +01:00
|
|
|
Your browser doesn't support mp4 video. :(
|
|
|
|
</video>
|
|
|
|
</div>
|
|
|
|
{{ else if eq $type "image" }}
|
2020-05-22 16:23:47 +02:00
|
|
|
<a href="{{ printf "%s%s" $path ($.Scratch.Get "src") }}" title="{{ $.Scratch.Get "title" }}">
|
|
|
|
<img src="{{ printf "%s%s" $path ($.Scratch.Get "src") }}" alt="{{ $.Scratch.Get "title" }}" />
|
|
|
|
</a>
|
2019-08-17 22:50:53 +02:00
|
|
|
{{ else if eq $type "imagelink" }}
|
|
|
|
<a href="{{ $.Scratch.Get "link" }}" style="border-bottom-style: none;" >
|
|
|
|
<img src="{{ printf "%s%s" $path ($.Scratch.Get "src") }}" alt="{{ $.Scratch.Get "title" }}" />
|
|
|
|
</a>
|
2018-03-10 18:03:45 +01:00
|
|
|
{{ end }}
|
|
|
|
<figcaption>
|
|
|
|
<h4>
|
2019-08-17 22:50:53 +02:00
|
|
|
{{ $.Scratch.Get "title" | markdownify }}
|
2018-03-10 18:03:45 +01:00
|
|
|
</h4>
|
|
|
|
</figcaption>
|
|
|
|
</figure>
|
|
|
|
</div>
|
|
|
|
{{ end }}
|
2020-05-22 16:23:47 +02:00
|
|
|
</div>
|
2018-03-10 18:03:45 +01:00
|
|
|
</div>
|