mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-19 20:05:30 -04:00
change a BUNCH of if's to with's to prepare for theme extraction
This commit is contained in:
@@ -1,21 +1,16 @@
|
||||
{{- $video_webm := .Page.Resources.GetMatch (.Get "webm") -}}
|
||||
{{- $video_mp4 := .Page.Resources.GetMatch (.Get "mp4") -}}
|
||||
{{- $video_ogg := .Page.Resources.GetMatch (.Get "ogg") -}}
|
||||
{{- $img_poster := .Page.Resources.GetMatch (.Get "poster") -}}
|
||||
|
||||
<amp-video
|
||||
layout="responsive"
|
||||
width="{{ if .Get "width" }}{{ .Get "width" }}{{ else }}910{{ end }}"
|
||||
height="{{ if .Get "height" }}{{ .Get "height" }}{{ else }}600{{ end }}"
|
||||
{{- if .Get "poster" }} poster="{{ $img_poster.Permalink }}"{{ end }}
|
||||
width="{{ with .Get "width" }}{{ . }}{{ else }}910{{ end }}"
|
||||
height="{{ with .Get "height" }}{{ . }}{{ else }}600{{ end }}"
|
||||
{{- with .Page.Resources.GetMatch (.Get "poster") }} poster="{{ .Permalink }}"{{ end }}
|
||||
{{- if .Get "autoplay" }} autoplay{{ end }}
|
||||
{{- if .Get "loop" }} loop{{ end }}
|
||||
{{- if ne (.Get "nocontrols") "1" }} controls{{ end }}>
|
||||
{{ if .Get "webm" }}<source src="{{ $video_webm.Permalink }}" type="video/webm">{{ end }}
|
||||
{{ if .Get "mp4" }}<source src="{{ $video_mp4.Permalink }}" type="video/mp4">{{ end }}
|
||||
{{ if .Get "ogg" }}<source src="{{ $video_ogg.Permalink }}" type="video/ogg">{{ end }}
|
||||
{{ with .Page.Resources.GetMatch (.Get "webm") }}<source src="{{ .Permalink }}" type="video/webm">{{ end }}
|
||||
{{ with .Page.Resources.GetMatch (.Get "mp4") }}<source src="{{ .Permalink }}" type="video/mp4">{{ end }}
|
||||
{{ with .Page.Resources.GetMatch (.Get "ogg") }}<source src="{{ .Permalink }}" type="video/ogg">{{ end }}
|
||||
|
||||
<div fallback>
|
||||
<p>Your browser does not support HTML5 video. <a href="{{ $video_mp4.Permalink }}">Load the .mp4 video directly.</a></p>
|
||||
<p>Your browser does not support HTML5 video. {{ with .Page.Resources.GetMatch (.Get "mp4") }}<a href="{{ .Permalink }}">Load the .mp4 video directly.</a>{{ end }}</p>
|
||||
</div>
|
||||
</amp-video>
|
||||
|
Reference in New Issue
Block a user