@@ -269,6 +269,41 @@ if (!doNotTrack) {
269
269
<!-- Output all taxonomies as schema.org keywords -->
270
270
<meta itemprop="keywords" content="{{ if .IsPage}}{{ range $index, $tag := .Params.tags }}{{ $tag }},{{ end }}{{ else }}{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}{{ end }}" />
271
271
{{ end }}` },
272
+ {`shortcodes/__h_simple_assets.html` , `{{ define "__h_simple_css" }}{{/* These template definitions are global. */}}
273
+ {{- if not (.Page.Scratch.Get "__h_simple_css") -}}
274
+ {{/* Only include once */}}
275
+ {{- .Page.Scratch.Set "__h_simple_css" true -}}
276
+ <style>
277
+ .__h_video {
278
+ position: relative;
279
+ padding-bottom: 56.23%;
280
+ height: 0;
281
+ overflow: hidden;
282
+ width: 100%;
283
+ background: #000;
284
+ }
285
+ .__h_video img {
286
+ max-width: 100%;
287
+ height: auto;
288
+ color: #000;
289
+ }
290
+ .__h_video .play {
291
+ height: 72px;
292
+ width: 72px;
293
+ left: 50%;
294
+ top: 50%;
295
+ margin-left: -36px;
296
+ margin-top: -36px;
297
+ position: absolute;
298
+ cursor: pointer;
299
+ }
300
+ </style>
301
+ {{- end -}}
302
+ {{- end -}}
303
+ {{- define "__h_simple_icon_play" -}}
304
+ <svg version="1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 61 61"><circle cx="30.5" cy="30.5" r="30.5" opacity=".8" fill="#000"></circle><path d="M25.3 19.2c-2.1-1.2-3.8-.2-3.8 2.2v18.1c0 2.4 1.7 3.4 3.8 2.2l16.6-9.1c2.1-1.2 2.1-3.2 0-4.4l-16.6-9z" fill="#fff"></path></svg>
305
+ {{- end -}}
306
+ ` },
272
307
{`shortcodes/figure.html` , `<!-- image -->
273
308
<figure{{ with .Get "class" }} class="{{.}}"{{ end }}>
274
309
{{ if .Get "link"}}<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>{{ end }}
@@ -361,14 +396,37 @@ if (!doNotTrack) {
361
396
{{- end -}}` },
362
397
{`shortcodes/vimeo.html` , `{{- $pc := .Page.Site.Config.Privacy.Vimeo -}}
363
398
{{- if not $pc.Disable -}}
364
- {{ if .IsNamedParams }}<div {{ if .Get "class" }}class="{{ .Get "class" }}"{{ else }}style="position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;"{{ end }}>
365
- <iframe src="//player.vimeo.com/video/{{ .Get "id" }}" {{ if not (.Get "class") }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" {{ end }}webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
399
+ {{- if $pc.Simple -}}
400
+ {{ template "_internal/shortcodes/vimeo_simple.html" . }}
401
+ {{- else -}}
402
+ {{ if .IsNamedParams }}<div {{ if .Get "class" }}class="{{ .Get "class" }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}>
403
+ <iframe src="//player.vimeo.com/video/{{ .Get "id" }}" {{ if not (.Get "class") }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" {{ end }}webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
366
404
</div>{{ else }}
367
- <div {{ if len .Params | eq 2 }}class="{{ .Get 1 }}"{{ else }}style="position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;"{{ end }}>
368
- <iframe src="//player.vimeo.com/video/{{ .Get 0 }}" {{ if len .Params | eq 1 }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" {{ end }}webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
405
+ <div {{ if len .Params | eq 2 }}class="{{ .Get 1 }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}>
406
+ <iframe src="//player.vimeo.com/video/{{ .Get 0 }}" {{ if len .Params | eq 1 }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0; " {{ end }}webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
369
407
</div>
370
408
{{ end }}
409
+ {{- end -}}
371
410
{{- end -}}` },
411
+ {`shortcodes/vimeo_simple.html` , `{{ $id := .Get "id" | default (.Get 0) }}
412
+ {{- $item := getJSON "https://vimeo.com/api/oembed.json?url=https://vimeo.com/" $id -}}
413
+ {{ $class := .Get "class" | default (.Get 1) }}
414
+ {{ $hasClass := $class }}
415
+ {{ $class := $class | default "__h_video" }}
416
+ {{ if not $hasClass }}
417
+ {{/* If class is set, assume the user wants to provide his own styles. */}}
418
+ {{ template "__h_simple_css" $ }}
419
+ {{ end }}
420
+ {{ $secondClass := "s_video_simple" }}
421
+ <div class="{{ $secondClass }} {{ $class }}">
422
+ {{- with $item }}
423
+ <a href="{{ .provider_url }}{{ .video_id | safeHTMLAttr }}" target="_blank">
424
+ {{ $thumb := .thumbnail_url }}
425
+ {{ $original := $thumb | replaceRE "(_.*\\.)" "." }}
426
+ <img src="{{ $thumb }}" srcset="{{ $thumb }} 1x, {{ $original }} 2x" alt="{{ .title }}">
427
+ <div class="play">{{ template "__h_simple_icon_play" $ }}</div></a></div>
428
+ {{- end -}}
429
+ ` },
372
430
{`shortcodes/youtube.html` , `{{- $pc := .Page.Site.Config.Privacy.YouTube -}}
373
431
{{- if not $pc.Disable -}}
374
432
{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
0 commit comments