fix: add class to unfurl fallback link to prevent YouTube double-embed
Build & Deploy / build-and-deploy (push) Successful in 1m52s
Build & Deploy / build-and-deploy (push) Successful in 1m52s
When unfurl cache is failed/missing for a YouTube URL, renderFallbackLink
returned a classless <a> which matched the youtube-link-to-embed transform
regex (the class exclusion from 819aab1 didn't protect it). This created
one embed from the custom transform and a second from eleventy-plugin-youtube-embed.
Adding class="unfurl-fallback" triggers the (?![^>]*\bclass=) exclusion,
preventing both embeds on like/repost pages with uncached YouTube URLs.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -76,7 +76,7 @@ export function escapeHtml(str) {
|
||||
|
||||
export function renderFallbackLink(url) {
|
||||
const domain = escapeHtml(extractDomain(url));
|
||||
return `<a href="${escapeHtml(url)}" rel="noopener" target="_blank">${domain}</a>`;
|
||||
return `<a href="${escapeHtml(url)}" rel="noopener" target="_blank" class="unfurl-fallback">${domain}</a>`;
|
||||
}
|
||||
|
||||
export function renderCard(url, metadata) {
|
||||
|
||||
Reference in New Issue
Block a user