fix: extend youtubeVideoId embed guard to all post types and templates
Build & Deploy / build-and-deploy (push) Successful in 1m56s

Reposts, bookmarks, replies, and in-reply-to sections were still falling
through to {% unfurl %} for YouTube URLs. Extended the lite-youtube embed
check (youtubeVideoId frontmatter) to every place that renders an external
URL: reply-context.njk (repost/in-reply-to/bookmark), blog.njk (bookmark/
repost/reply branches), reposts.njk, bookmarks.njk, replies.njk, and the
recent-posts and featured-posts homepage widget sections.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
svemagie
2026-04-11 19:28:52 +02:00
parent 69ec9d07e2
commit 24e7a58029
7 changed files with 102 additions and 0 deletions
+18
View File
@@ -19,7 +19,13 @@
</svg>
<span>In reply to:</span>
</p>
{% if youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{% unfurl replyTo %}
{% endif %}
<a class="u-url text-xs text-surface-600 dark:text-surface-400 hover:underline break-all" href="{{ replyTo }}">
{{ replyTo }}
</a>
@@ -55,7 +61,13 @@
</svg>
<span>Reposted:</span>
</p>
{% if youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{% unfurl repostedUrl %}
{% endif %}
<a class="u-url text-xs text-surface-600 dark:text-surface-400 hover:underline break-all" href="{{ repostedUrl }}">
{{ repostedUrl }}
</a>
@@ -70,7 +82,13 @@
</svg>
<span>Bookmarked:</span>
</p>
{% if youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{% unfurl bookmarkedUrl %}
{% endif %}
<a class="u-url text-xs text-surface-600 dark:text-surface-400 hover:underline break-all" href="{{ bookmarkedUrl }}">
{{ bookmarkedUrl }}
</a>
@@ -59,7 +59,13 @@
{{ post.date | dateDisplay }}
</time>
</div>
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{{ likedUrl | unfurlCard | safe }}
{% endif %}
<a class="u-like-of text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ likedUrl }}">
{{ likedUrl }}
</a>
@@ -92,7 +98,13 @@
<a class="text-surface-900 dark:text-surface-100 hover:text-accent-600 dark:hover:text-accent-400 hover:underline" href="{{ post.url }}">{{ post.data.title }}</a>
</h3>
{% endif %}
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{{ bookmarkedUrl | unfurlCard | safe }}
{% endif %}
<a class="u-bookmark-of text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ bookmarkedUrl }}">
{{ bookmarkedUrl }}
</a>
@@ -120,7 +132,13 @@
{{ post.date | dateDisplay }}
</time>
</div>
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{{ repostedUrl | unfurlCard | safe }}
{% endif %}
<a class="u-repost-of text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ repostedUrl }}">
{{ repostedUrl }}
</a>
@@ -148,7 +166,13 @@
{{ post.date | dateDisplay }}
</time>
</div>
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{{ replyToUrl | unfurlCard | safe }}
{% endif %}
<a class="u-in-reply-to text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ replyToUrl }}">
{{ replyToUrl }}
</a>
@@ -75,7 +75,13 @@
{% endif %}
{% include "components/garden-badge.njk" %}
</div>
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{{ likedUrl | unfurlCard | safe }}
{% endif %}
<a class="u-like-of text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ likedUrl }}">
{{ likedUrl }}
</a>
@@ -120,7 +126,13 @@
<a class="hover:text-amber-800 dark:hover:text-amber-400" href="{{ post.url }}">{{ post.data.title }}</a>
</h3>
{% endif %}
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{{ bookmarkedUrl | unfurlCard | safe }}
{% endif %}
<a class="u-bookmark-of text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ bookmarkedUrl }}">
{{ bookmarkedUrl }}
</a>
@@ -160,7 +172,13 @@
{% endif %}
{% include "components/garden-badge.njk" %}
</div>
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{{ repostedUrl | unfurlCard | safe }}
{% endif %}
<a class="u-repost-of text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ repostedUrl }}">
{{ repostedUrl }}
</a>
@@ -200,7 +218,13 @@
{% endif %}
{% include "components/garden-badge.njk" %}
</div>
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{{ replyToUrl | unfurlCard | safe }}
{% endif %}
<a class="u-in-reply-to text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ replyToUrl }}">
{{ replyToUrl }}
</a>
+18
View File
@@ -136,7 +136,13 @@ permalink: "blog/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber
<a class="hover:text-[#b57614] dark:hover:text-[#d79921]" href="{{ post.url }}">{{ post.data.title }}</a>
</h2>
{% endif %}
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{% unfurl bookmarkedUrl %}
{% endif %}
<a class="u-bookmark-of text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ bookmarkedUrl }}">
{{ bookmarkedUrl }}
</a>
@@ -178,7 +184,13 @@ permalink: "blog/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber
{% endif %}
{% include "components/garden-badge.njk" %}
</div>
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{% unfurl repostedUrl %}
{% endif %}
<a class="u-repost-of text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ repostedUrl }}">
{{ repostedUrl }}
</a>
@@ -220,7 +232,13 @@ permalink: "blog/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber
{% endif %}
{% include "components/garden-badge.njk" %}
</div>
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{% unfurl replyToUrl %}
{% endif %}
<a class="u-in-reply-to text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ replyToUrl }}">
{{ replyToUrl }}
</a>
+6
View File
@@ -55,7 +55,13 @@ permalink: "bookmarks/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageN
{# Support both camelCase (Indiekit Eleventy preset) and underscore (legacy) property names #}
{% set bookmarkedUrl = post.data.bookmarkOf or post.data.bookmark_of %}
{% if bookmarkedUrl %}
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{% unfurl bookmarkedUrl %}
{% endif %}
<a class="u-bookmark-of text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ bookmarkedUrl }}">
{{ bookmarkedUrl }}
</a>
+6
View File
@@ -59,7 +59,13 @@ permalink: "replies/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNum
{% set replyTo = post.data.inReplyTo or post.data.in_reply_to %}
{% if replyTo %}
{% set protocol = replyTo | protocolType %}
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{% unfurl replyTo %}
{% endif %}
<p class="mt-2 text-sm flex items-center gap-2 flex-wrap">
<span class="text-surface-600">In reply to:</span>
<a class="u-in-reply-to text-xs text-surface-600 dark:text-surface-400 hover:underline break-all" href="{{ replyTo }}">
+6
View File
@@ -58,7 +58,13 @@ permalink: "reposts/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNum
{# Support both camelCase (Indiekit Eleventy preset) and underscore (legacy) property names #}
{% set repostedUrl = post.data.repostOf or post.data.repost_of %}
{% if repostedUrl %}
{% if post.data.youtubeVideoId %}
<div class="video-embed eleventy-plugin-youtube-embed not-prose my-4">
<lite-youtube videoid="{{ post.data.youtubeVideoId }}" style="background-image: url('https://i.ytimg.com/vi/{{ post.data.youtubeVideoId }}/hqdefault.jpg');"><div class="lty-playbtn"></div></lite-youtube>
</div>
{% else %}
{% unfurl repostedUrl %}
{% endif %}
<a class="u-repost-of text-xs text-surface-600 dark:text-surface-400 hover:underline break-all mt-1 inline-block" href="{{ repostedUrl }}">
{{ repostedUrl }}
</a>