fix: links to index not showing in graph (closes #450)
This commit is contained in:
parent
828aa71fe3
commit
2525bfbab5
@ -142,6 +142,7 @@ async function startServing(
|
|||||||
|
|
||||||
const parsedFiles = [...contentMap.values()]
|
const parsedFiles = [...contentMap.values()]
|
||||||
const filteredContent = filterContent(ctx, parsedFiles)
|
const filteredContent = filterContent(ctx, parsedFiles)
|
||||||
|
|
||||||
// TODO: we can probably traverse the link graph to figure out what's safe to delete here
|
// TODO: we can probably traverse the link graph to figure out what's safe to delete here
|
||||||
// instead of just deleting everything
|
// instead of just deleting everything
|
||||||
await rimraf(argv.output)
|
await rimraf(argv.output)
|
||||||
|
@ -47,11 +47,12 @@ async function renderGraph(container: string, fullSlug: FullSlug) {
|
|||||||
const data = await fetchData
|
const data = await fetchData
|
||||||
|
|
||||||
const links: LinkData[] = []
|
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)) {
|
for (const [src, details] of Object.entries<ContentDetails>(data)) {
|
||||||
const source = simplifySlug(src as FullSlug)
|
const source = simplifySlug(src as FullSlug)
|
||||||
const outgoing = details.links ?? []
|
const outgoing = details.links ?? []
|
||||||
for (const dest of outgoing) {
|
for (const dest of outgoing) {
|
||||||
if (dest in data) {
|
if (validLinks.has(dest)) {
|
||||||
links.push({ source, target: dest })
|
links.push({ source, target: dest })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import {
|
|||||||
SimpleSlug,
|
SimpleSlug,
|
||||||
TransformOptions,
|
TransformOptions,
|
||||||
_stripSlashes,
|
_stripSlashes,
|
||||||
joinSegments,
|
|
||||||
simplifySlug,
|
simplifySlug,
|
||||||
splitAnchor,
|
splitAnchor,
|
||||||
transformLink,
|
transformLink,
|
||||||
|
Loading…
Reference in New Issue
Block a user