the home site for me: also iteration 3 or 4 of my site

chore: fix youtube embeds

Changed files
+26 -11
content
sass
templates
shortcodes
+1 -1
content/blog/2024-10-11_example_post.md
···
To embed a video, you use whatever embed tag works. For example, YouTube provides an `<iframe>` tag for
videos that you can use to embed into the page:
-
<iframe src="https://www.youtube.com/embed/kiWvNwuBbEE" title="Ikenfell Launch Trailer" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
+
{{ youtube(id="kiWvNwuBbEE") }}
Do not use a `width` or `height` when doing this. The video should always be the full width of the page,
and the height will be auto-calculated based on a 16:9 aspect ratio.
+11
sass/css/mods.css
···
margin: 0;
color: var(--accent-text);
}
+
+
.yt-embed {
+
width: 100%;
+
display: flex;
+
justify-content: center;
+
}
+
+
.yt-embed iframe {
+
width: 100%;
+
aspect-ratio: 16 / 9;
+
}
+4 -1
sass/css/suCSS.css
···
}
img,
-
video {
+
video,
+
iframe[src^="https://www.youtube-nocookie.com"],
+
iframe[src^="https://www.youtube.com"]
+
{
max-width: 90%;
height: auto;
padding: 0.125rem;
+10 -9
templates/shortcodes/youtube.html
···
-
<div {% if class %}class="{{class}}"{% endif %}>
-
<iframe
-
src="https://www.youtube-nocookie.com/embed/{{id}}{% if autoplay %}?autoplay=1{% endif %}"
-
allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
-
webkitallowfullscreen
-
mozallowfullscreen
-
allowfullscreen>
-
</iframe>
-
</div>
+
<div class="yt-embed">
+
<iframe
+
src="https://www.youtube-nocookie.com/embed/{{id}}{% if autoplay %}?autoplay=1{% endif %}"
+
allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
+
webkitallowfullscreen
+
mozallowfullscreen
+
allowfullscreen
+
>
+
</iframe>
+
</div>