aboutsummaryrefslogtreecommitdiff
path: root/themes/hugo-theme-stack/layouts/shortcodes/youtube.html
blob: 2f859315f9e0bcc3a5f1ace46576fd897ef3827d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
{{- $pc := .Page.Site.Config.Privacy.YouTube -}}
{{- if not $pc.Disable -}}
{{- $ytHost := cond $pc.PrivacyEnhanced  "www.youtube-nocookie.com" "www.youtube.com" -}}
{{- $id := .Get "id" | default (.Get 0) -}}
<div class="video-wrapper">
    <iframe loading="lazy" 
            src="https://{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" 
            allowfullscreen 
            title="YouTube Video"
    >
    </iframe>
</div>
{{ end -}}