fix: prevent microformat links from being converted to YouTube embeds
Build & Deploy / build-and-deploy (push) Failing after 1m3s

YouTube repost/like/bookmark cards were showing the video thumbnail
twice: once from the unfurl card and once from the u-repost-of anchor
tag being matched by the youtube-link-to-embed transform.

Add a negative lookahead (?![^>]*\bclass=) to the transform regex so
that <a> tags with a class attribute are skipped. Microformat links
(u-repost-of, u-like-of, u-bookmark-of) and unfurl fallback links
always carry classes; bare YouTube URLs in Markdown content do not.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
svemagie
2026-04-11 17:41:48 +02:00
parent b2d5920585
commit 819aab1883
29 changed files with 210 additions and 54 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ webmentionResults:
skipped: []
timestamp: 2026-03-23T19:16:24.363Z
webmentionSent: true
updated: 2026-03-23T19:18:24.793Z
updated: 2026-04-10, 09:34:08
mpUrl: https://blog.giersig.eu/articles/du-machst-es-dir-aber/
permalink: /articles/du-machst-es-dir-aber/
---
+6
View File
@@ -39,4 +39,10 @@ webmentionResults:
timestamp: 2026-03-09T19:23:25.984Z
webmentionSent: true
permalink: https://blog.giersig.eu/bookmarks/14b61/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -38,4 +38,10 @@ syndication:
updated: 2026-03-21T06:43:38.794Z
mpUrl: https://blog.giersig.eu/bookmarks/aral-balkan/
permalink: /bookmarks/aral-balkan/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -24,4 +24,10 @@ syndication:
updated: 2026-03-21T06:41:01.073Z
mpUrl: https://blog.giersig.eu/bookmarks/brennans-weblog/
permalink: /bookmarks/brennans-weblog/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -8,4 +8,10 @@ syndication:
updated: 2026-04-04T13:46:49.677Z
mpUrl: https://blog.giersig.eu/bookmarks/ccd7b/
permalink: /bookmarks/ccd7b/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -8,4 +8,10 @@ syndication:
updated: 2026-03-23T12:28:12.790Z
mpUrl: https://blog.giersig.eu/bookmarks/d733c/
permalink: /bookmarks/d733c/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -9,4 +9,10 @@ syndication:
updated: 2026-03-31T16:15:23.934Z
mpUrl: https://blog.giersig.eu/bookmarks/espressionismus/
permalink: /bookmarks/espressionismus/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
@@ -21,4 +21,10 @@ syndication:
- https://blog.giersig.eu/bookmarks/jamies-smallweb-garden-with-some/
updated: 2026-03-14T18:26:57.414Z
permalink: https://blog.giersig.eu/bookmarks/jamies-smallweb-garden-with-some/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
@@ -8,4 +8,10 @@ syndication:
updated: 2026-04-04T07:53:47.028Z
mpUrl: https://blog.giersig.eu/bookmarks/paleofuture-the-history-of-the/
permalink: /bookmarks/paleofuture-the-history-of-the/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
@@ -8,4 +8,10 @@ syndication:
updated: 2026-03-25T18:35:54.012Z
mpUrl: https://blog.giersig.eu/bookmarks/social-media-addiction-case/
permalink: /bookmarks/social-media-addiction-case/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
@@ -22,4 +22,10 @@ syndication:
- https://blog.giersig.eu/bookmarks/telegraph-easily-send-webmentions-from/
mpUrl: https://blog.giersig.eu/bookmarks/telegraph-easily-send-webmentions-from/
permalink: /bookmarks/telegraph-easily-send-webmentions-from/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -23,4 +23,10 @@ syndication:
- https://blog.giersig.eu/likes/646df/
mpUrl: https://blog.giersig.eu/likes/646df/
permalink: /likes/646df/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -3,4 +3,10 @@ date: 2026-03-18T16:18:18.492Z
likeOf: https://www.joanwestenberg.com/the-optimized-self-and-the-life-that-got-away/
mpUrl: https://blog.giersig.eu/likes/7f03f/
permalink: /likes/7f03f/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -22,4 +22,10 @@ webmentionResults:
webmentionSent: true
mpUrl: https://blog.giersig.eu/likes/8ce59/
permalink: /likes/8ce59/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -16,4 +16,10 @@ webmentionSent: true
category: on/activism
updated: 2026-03-15T09:59:43.858Z
permalink: https://blog.giersig.eu/likes/947c7/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6 -2
View File
@@ -10,6 +10,10 @@ permalink: https://blog.giersig.eu/likes/ae278/
ai:
textLevel: "0"
codeLevel: "0"
# aiTools: "Claude, ChatGPT, Copilot"
# aiDescription: "Optional disclosure about how AI was used"
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -11,4 +11,10 @@ syndication:
updated: 2026-04-01T09:28:02.233Z
mpUrl: https://blog.giersig.eu/likes/cfde8/
permalink: /likes/cfde8/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -17,4 +17,10 @@ category: smallweb
updated: 2026-03-20T05:45:07.894Z
mpUrl: https://blog.giersig.eu/likes/d8b6c/
permalink: /likes/d8b6c/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -7,4 +7,10 @@ syndication:
updated: 2026-03-22T11:57:20.871Z
mpUrl: https://blog.giersig.eu/likes/d919b/
permalink: /likes/d919b/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -9,4 +9,10 @@ youtubeThumbnail: https://i.ytimg.com/vi/Hq85Zqy6IZU/mqdefault.jpg
draft: true
mpUrl: https://blog.giersig.eu/likes/yt-like-Hq85Zqy6IZU/
permalink: /likes/yt-like-Hq85Zqy6IZU/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -10,4 +10,10 @@ syndication:
updated: 2026-04-07T07:41:17.726Z
mpUrl: https://blog.giersig.eu/reposts/08f73/
permalink: /reposts/08f73/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -8,4 +8,10 @@ syndication:
updated: 2026-04-07T07:46:31.971Z
mpUrl: https://blog.giersig.eu/reposts/19cc2/
permalink: /reposts/19cc2/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -8,4 +8,10 @@ syndication:
updated: 2026-04-09T19:09:12.529Z
mpUrl: https://blog.giersig.eu/reposts/47020/
permalink: /reposts/47020/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -8,4 +8,10 @@ syndication:
updated: 2026-04-08T08:07:31.214Z
mpUrl: https://blog.giersig.eu/reposts/585f1/
permalink: /reposts/585f1/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -21,4 +21,10 @@ syndication:
updated: 2026-04-07T17:21:07.241Z
mpUrl: https://blog.giersig.eu/reposts/61a03/
permalink: /reposts/61a03/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -11,4 +11,10 @@ syndication:
updated: 2026-04-07T07:37:37.270Z
mpUrl: https://blog.giersig.eu/reposts/83c44/
permalink: /reposts/83c44/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+6
View File
@@ -11,4 +11,10 @@ syndication:
updated: 2026-04-09T13:38:05.111Z
mpUrl: https://blog.giersig.eu/reposts/f616a/
permalink: /reposts/f616a/
up: []
related: []
created: 2026-03-31 19:01
tags:
collection:
---
+3 -1
View File
@@ -336,7 +336,9 @@ export default function (eleventyConfig) {
}
// Match <a> tags where href contains youtube.com/watch or youtu.be
// Link text can be: URL, www.youtube..., youtube..., or youtube-related text
const youtubePattern = /<a[^>]+href="https?:\/\/(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)[^"]*"[^>]*>(?:https?:\/\/)?(?:www\.)?[^<]*(?:youtube|youtu\.be)[^<]*<\/a>/gi;
// Exclude links with a class attribute — those are intentional microformat/styled
// links (u-repost-of, u-like-of, unfurl cards, etc.) that must not become embeds.
const youtubePattern = /<a(?![^>]*\bclass=)[^>]+href="https?:\/\/(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)[^"]*"[^>]*>(?:https?:\/\/)?(?:www\.)?[^<]*(?:youtube|youtu\.be)[^<]*<\/a>/gi;
content = content.replace(youtubePattern, (match, videoId) => {
// Use lite-youtube facade — loads full iframe only on click