mirror of
https://github.com/quartz-community/crawl-links.git
synced 2026-07-22 02:50:29 +00:00
fix: add frontmatter links to the existing links set
This commit is contained in:
parent
0218662b7f
commit
42bdb5d0eb
1 changed files with 13 additions and 0 deletions
|
|
@ -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];
|
||||
};
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue