vimeo_simple.html (984B)
1 {{- $pc := .Page.Site.Config.Privacy.Vimeo -}}
2 {{- if not $pc.Disable -}}
3 {{ $id := .Get "id" | default (.Get 0) }}
4 {{ $dnt := cond (eq $pc.EnableDNT true) "?dnt=1" "" }}
5 {{- $item := getJSON (print "https://vimeo.com/api/oembed.json?url=https://vimeo.com/" $id $dnt) -}}
6 {{ $class := .Get "class" | default (.Get 1) }}
7 {{ $hasClass := $class }}
8 {{ $class := $class | default "__h_video" }}
9 {{ if not $hasClass }}
10 {{/* If class is set, assume the user wants to provide his own styles. */}}
11 {{ template "__h_simple_css" $ }}
12 {{ end }}
13 {{ $secondClass := "s_video_simple" }}
14 <div class="{{ $secondClass }} {{ $class }}">
15 {{- with $item }}
16 <a href="{{ .provider_url }}{{ .video_id }}" rel="noopener" target="_blank">
17 {{ $thumb := .thumbnail_url }}
18 {{ $original := $thumb | replaceRE "(_.*\\.)" "." }}
19 <img src="{{ $thumb }}" srcset="{{ $thumb }} 1x, {{ $original }} 2x" alt="{{ .title }}">
20 <div class="play">{{ template "__h_simple_icon_play" $ }}</div></a></div>
21 {{- end -}}
22 {{- end -}}