fix: extractFirstImage matching x-bind:src from Alpine.js
The regex matched x-bind:src="comment.author.photo" from the comments component, causing the literal string to appear in og:image meta tags. Every Mastodon instance fetching OG data hit /comment.author.photo → 404. Require whitespace before src= so only actual HTML src attributes match.
This commit is contained in:
@@ -335,7 +335,7 @@ export default function (eleventyConfig) {
|
||||
eleventyConfig.addFilter("extractFirstImage", (content) => {
|
||||
if (!content) return null;
|
||||
// Match all <img> tags, skip hidden ones and data URIs
|
||||
const imgRegex = /<img[^>]+src=["']([^"']+)["'][^>]*>/gi;
|
||||
const imgRegex = /<img[^>]*?\ssrc=["']([^"']+)["'][^>]*>/gi;
|
||||
let match;
|
||||
while ((match = imgRegex.exec(content)) !== null) {
|
||||
const fullTag = match[0];
|
||||
|
||||
Reference in New Issue
Block a user