mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
committed by
Bjørn Erik Pedersen
parent
20cbc2c785
commit
8de5324479
18
tpl/tplimpl/embedded/templates/shortcodes/vimeo_simple.html
Normal file
18
tpl/tplimpl/embedded/templates/shortcodes/vimeo_simple.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{{ $id := .Get "id" | default (.Get 0) }}
|
||||
{{- $item := getJSON "https://vimeo.com/api/oembed.json?url=https://vimeo.com/" $id -}}
|
||||
{{ $class := .Get "class" | default (.Get 1) }}
|
||||
{{ $hasClass := $class }}
|
||||
{{ $class := $class | default "__h_video" }}
|
||||
{{ if not $hasClass }}
|
||||
{{/* If class is set, assume the user wants to provide his own styles. */}}
|
||||
{{ template "__h_simple_css" $ }}
|
||||
{{ end }}
|
||||
{{ $secondClass := "s_video_simple" }}
|
||||
<div class="{{ $secondClass }} {{ $class }}">
|
||||
{{- with $item }}
|
||||
<a href="{{ .provider_url }}{{ .video_id | safeHTMLAttr }}" target="_blank">
|
||||
{{ $thumb := .thumbnail_url }}
|
||||
{{ $original := $thumb | replaceRE "(_.*\\.)" "." }}
|
||||
<img src="{{ $thumb }}" srcset="{{ $thumb }} 1x, {{ $original }} 2x" alt="{{ .title }}">
|
||||
<div class="play">{{ template "__h_simple_icon_play" $ }}</div></a></div>
|
||||
{{- end -}}
|
Reference in New Issue
Block a user