uci-shortcodes/layouts/shortcodes/youtube.html

39 lines
1.5 KiB
HTML
Raw Permalink Normal View History

{{ $.Scratch.Set "maxwidth" ( $.Page.Site.Params.youtube.maxwidth ) }}
{{ $.Scratch.Set "wpad" ( $.Page.Site.Params.youtube.wpad ) }}
{{ $.Scratch.Set "nothumb" ( $.Page.Site.Params.youtube.disable_thumb ) }}
{{ if .IsNamedParams }}
{{ with .Get "maxwidth" }}{{ $.Scratch.Set "maxwidth" . }}{{ end }}
{{ with .Get "wpad" }}{{ $.Scratch.Set "wpad" . }}{{ end }}
{{ with .Get "nothumb" }}{{ $.Scratch.Set "nothumb" . }}{{ end }}
<div class="box box--embed box--column box--youtube">
{{ with .Get "title" }}
<div class="box__title">{{ . }}</div>
{{ end }}
<div
youtube_id="{{ .Get "id" }}"
{{ with .Get "start"}} start="{{ . }}"{{ end }}
{{ with .Get "end"}} end="{{ . }}"{{ end }}
{{ with .Get "plist"}} list="{{ . }}"{{ end }}
{{ with $.Scratch.Get "maxwidth"}} maxWidth="{{ . }}"{{ end }}
{{ with $.Scratch.Get "wpad"}} wPad="{{ . }}"{{ end }}
{{ with $.Scratch.Get "nothumb"}} nothumb="yes" {{ end }}
>
<!-- thumb and video get put here -->
</div>
{{ with .Get "caption"}}
<div class="box__caption">{{ . }}</div>
{{ end }}
</div>
{{ else }}
{{ $numOfParams := ( len .Params ) }}
<div class="box box--embed box--youtube"
youtube_id="{{ .Get 0 }}"
{{ if eq $numOfParams 2 }} start="{{ .Get 1 }}"{{ end }}
{{ with $.Scratch.Get "maxwidth"}} maxWidth="{{ . }}"{{ end }}
{{ with $.Scratch.Get "wpad"}} wPad="{{ . }}"{{ end }}
{{ with $.Scratch.Get "nothumb"}} nothumb="yes" {{ end }}
>
<!-- image or iframe injected here -->
</div>
{{ end }}