{{- /* Renders an embedded Vimeo video. Accepts named or positional arguments. If positional, order is id, class, title, then loading. @param {bool} [allowFullScreen=true] Whether the iframe element can activate full screen mode. @param {string} [class] The class attribute of the wrapping div element. When specified, removes the style attributes from the iframe element and its wrapping div element. @param {string} [id] The video id. Optional if the id is the first and only positional argument. @param {string} [loading=eager] The loading attribute of the iframe element. @param {string} [title=Vimeo video] The title attribute of the iframe element. @returns {template.HTML} @example {{< vimeo 55073825 >}} @example {{< vimeo id=55073825 class="foo bar" loading=lazy title="My Video" >}} */}} {{- $pc := site.Config.Privacy.Vimeo }} {{- if not $pc.Disable }} {{- if $pc.Simple }} {{- template "_shortcodes/vimeo_simple.html" . }} {{- else }} {{- $dnt := cond $pc.EnableDNT 1 0 }} {{- $allowFullScreen := true }} {{- $class := or (.Get "class") }} {{- $id := or (.Get "id") (.Get 0) }} {{- $loading := or (.Get "loading") }} {{- $title := or (.Get "title") }} {{- if in (slice "true" true 1) (.Get "allowFullScreen") }} {{- $allowFullScreen = true }} {{- else if in (slice "false" false 0) (.Get "allowFullScreen") }} {{- $allowFullScreen = false }} {{- end }} {{- $iframeAllowList := "" }} {{- if $allowFullScreen }} {{- $iframeAllowList = "fullscreen" }} {{- end }} {{- $divStyle := "position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;" }} {{- $iframeStyle := "position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" }} {{- with $id }} {{- $src := printf "https://player.vimeo.com/video/%v?dnt=%v" . $dnt }}
{{- else }} {{- errorf "The %q shortcode requires a video id, either as the first positional argument or an argument named id. See %s" .Name .Position }} {{- end }} {{- end }} {{- end }}