add default tag

This commit is contained in:
zhixuan 2021-08-26 15:55:36 +09:00
parent e24f5672c3
commit 6bbef14f8c
No known key found for this signature in database
GPG Key ID: 05D14AD50C51A06F

View File

@ -1,13 +1,14 @@
{{- $src := .Get "src" | default (.Get 0) -}}
<div class="video-wrapper">
<video
controls
src="{{- $src -}}"
{{ with .Get "poster" }}poster="{{- . -}}"{{ end }}
{{ with .Get "src" }}src="{{- . -}}"{{ end }}
{{ with .Get "autoplay" }}autoplay{{ end }}
>
<p>
Your browser doesn't support HTML5 video. Here is a
<a href="{{ with .Get "src" }}{{- . -}}{{ end }}">link to the video</a> instead.
<a href="{{- $src -}}">link to the video</a> instead.
</p>
</video>
</div>