feat(article): add positional parameter for video shortcode (#331)

This commit is contained in:
zhixuan 2021-08-27 01:50:03 +09:00 committed by GitHub
parent 080c86ec79
commit 9c7e73646c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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