yArgs := or $args.queryArgs $args.options }}
{{ $origin := $args.position }}
{{ if not $origin }}{{ with $args.page.File }}{{ $origin = $args.Path }}{{ end }}{{ end }}

{{/* Main code */}}
{{ if not $error -}}
    {{ if eq $provider "youtube" }}
        {{- $host := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
        {{ $url := printf "https://%s/embed/%s?origin=%s" $host $id $args.page.Site.BaseURL }}
        {{ $api := printf "https://www.youtube.com/oembed?format=json&url=%s