fix: add frontmatter links to the existing links set

This commit is contained in:
saberzero1 2026-05-22 02:51:18 +02:00
parent 0218662b7f
commit 42bdb5d0eb
No known key found for this signature in database

View file

@ -170,6 +170,19 @@ export const CrawlLinks: QuartzTransformerPlugin<Partial<CrawlLinksOptions>> = (
}
});
const frontmatterLinks = (file.data.frontmatterLinks as string[] | undefined) ?? [];
for (const fmLink of frontmatterLinks) {
const [targetRaw] = splitAnchor(fmLink);
if (!targetRaw) continue;
const dest = transformLink(fileSlug, targetRaw, transformOptions);
const url = new URL(dest, "https://base.com/" + stripSlashes(curSlug, true));
const [canonicalRaw] = splitAnchor(url.pathname);
let canonical = canonicalRaw;
if (canonical.endsWith("/")) canonical += "index";
const full = decodeURIComponent(stripSlashes(canonical, true)) as FullSlug;
outgoing.add(simplifySlug(full));
}
file.data.links = [...outgoing];
};
},