diff --git a/quartz/components/scripts/graph.inline.ts b/quartz/components/scripts/graph.inline.ts index dbddae91f5021..5c5f335f3f0f8 100644 --- a/quartz/components/scripts/graph.inline.ts +++ b/quartz/components/scripts/graph.inline.ts @@ -99,6 +99,13 @@ async function renderGraph(container: string, fullSlug: FullSlug) { const tags: SimpleSlug[] = [] const validLinks = new Set(data.keys()) + const aliases = new Map() + for (const [slug, details] of data.entries()) { + for (const alias of details.aliases) { + aliases.set(simplifySlug(alias), slug) + } + } + const tweens = new Map() for (const [source, details] of data.entries()) { const outgoing = details.links ?? [] @@ -107,6 +114,10 @@ async function renderGraph(container: string, fullSlug: FullSlug) { if (validLinks.has(dest)) { links.push({ source: source, target: dest }) } + const aliased = aliases.get(dest) + if (aliased) { + links.push({ source: source, target: aliased }) + } } if (showTags) { diff --git a/quartz/plugins/emitters/contentIndex.ts b/quartz/plugins/emitters/contentIndex.ts index c0fef86d27100..fb7610163d9ee 100644 --- a/quartz/plugins/emitters/contentIndex.ts +++ b/quartz/plugins/emitters/contentIndex.ts @@ -14,6 +14,7 @@ export type ContentDetails = { title: string links: SimpleSlug[] tags: string[] + aliases: FullSlug[] content: string richContent?: string date?: Date @@ -125,6 +126,7 @@ export const ContentIndex: QuartzEmitterPlugin> = (opts) => { title: file.data.frontmatter?.title!, links: file.data.links ?? [], tags: file.data.frontmatter?.tags ?? [], + aliases: file.data.aliases ?? [], content: file.data.text ?? "", richContent: opts?.rssFullHtml ? escapeHTML(toHtml(tree as Root, { allowDangerousHtml: true }))