From 2525bfbab5553f970997ea3c60af180cbef1fdd2 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Thu, 07 Sep 2023 05:24:15 +0000
Subject: [PATCH] fix: links to index not showing in graph (closes #450)
---
quartz/components/scripts/graph.inline.ts | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/quartz/components/scripts/graph.inline.ts b/quartz/components/scripts/graph.inline.ts
index d72b297..dc5c99d 100644
--- a/quartz/components/scripts/graph.inline.ts
+++ b/quartz/components/scripts/graph.inline.ts
@@ -47,11 +47,12 @@
const data = await fetchData
const links: LinkData[] = []
+ const validLinks = new Set(Object.keys(data).map((slug) => simplifySlug(slug as FullSlug)))
for (const [src, details] of Object.entries<ContentDetails>(data)) {
const source = simplifySlug(src as FullSlug)
const outgoing = details.links ?? []
for (const dest of outgoing) {
- if (dest in data) {
+ if (validLinks.has(dest)) {
links.push({ source, target: dest })
}
}
--
Gitblit v1.10.0