compose-theme/layouts/shortcodes/youtube.html

9 lines
301 B
HTML
Raw Permalink Normal View History

2024-07-26 17:08:59 +02:00
{{- $youtubeHost := "https://www.youtube.com/watch?v=" }}
{{- $url := .Get 0 }}
{{- if in $url $youtubeHost }}
{{- $url = strings.TrimPrefix $youtubeHost $url }}
{{- end }}
<div class="video">
<iframe src="https://www.youtube.com/embed/{{ $url }}?controls=1&rel=0" loading="lazy"></iframe>
</div>