revamped video shortcode

This commit is contained in:
Gabriele Musco 2022-04-02 00:50:27 +02:00
parent eaa947df25
commit f0aadb0370
No known key found for this signature in database
GPG Key ID: 0587A5D65B5DC99E
1 changed files with 33 additions and 3 deletions

View File

@ -1,3 +1,33 @@
<video autoplay loop style="max-width: 100%;">
<source src="{{ .Get 0 }}" />
</video>
{{ $h265 := .Get "h265" }}
{{ $h264 := .Get "h264" }}
{{ $vp9 := .Get "vp9" }}
{{ $vp8 := .Get "vp8" }}
{{ $caption := .Get "caption" }}
{{ $attr := .Get "attr" }}
{{ $attrlink := .Get "attrlink" }}
<figure>
<video autoplay loop controls style="max-width: 100%;">
{{ if $h265 }}
<source src='{{ $h265 }}' />
{{ end }}
{{ if $h264 }}
<source src='{{ $h264 }}' />
{{ end }}
{{ if $vp9 }}
<source src='{{ $vp9 }}' />
{{ end }}
{{ if $vp8 }}
<source src='{{ $vp8 }}' />
{{ end }}
</video>
{{ if or $caption $attr }}
<figcaption>
{{ if $caption }}
<p>{{ . }}</p>
{{ end }}
<p>
{{ if $attrlink }}<a href="{{ $attrlink }}">{{ end }}{{ $attr }}{{ if $attrlink }}</a>{{ end }}
</p>
</figcaption>
{{ end }}
</figure>