Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(aliases): Make sure the graph shows aliased pages #1682

Open
wants to merge 1 commit into
base: v4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions quartz/components/scripts/graph.inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ async function renderGraph(container: string, fullSlug: FullSlug) {
const tags: SimpleSlug[] = []
const validLinks = new Set(data.keys())

const aliases = new Map<SimpleSlug, SimpleSlug>()
for (const [slug, details] of data.entries()) {
for (const alias of details.aliases) {
aliases.set(simplifySlug(alias), slug)
}
}

const tweens = new Map<string, TweenNode>()
for (const [source, details] of data.entries()) {
const outgoing = details.links ?? []
Expand All @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions quartz/plugins/emitters/contentIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
title: string
links: SimpleSlug[]
tags: string[]
aliases: FullSlug[]
content: string
richContent?: string
date?: Date
Expand Down Expand Up @@ -125,6 +126,7 @@
title: file.data.frontmatter?.title!,
links: file.data.links ?? [],
tags: file.data.frontmatter?.tags ?? [],
aliases: file.data.aliases ?? [],

Check failure on line 129 in quartz/plugins/emitters/contentIndex.ts

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Type '{}' is missing the following properties from type 'FullSlug[]': length, pop, push, concat, and 35 more.
content: file.data.text ?? "",
richContent: opts?.rssFullHtml
? escapeHTML(toHtml(tree as Root, { allowDangerousHtml: true }))
Expand Down
Loading