From 6093c863a693d6e29f05911b81d10ad78ba36d86 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Fri, 11 Aug 2023 23:25:44 -0700 Subject: [PATCH] fix emit filepaths, tag emit being overriden by content --- content/features/private pages.md | 2 ++ content/features/table of contents.md | 2 +- quartz.config.ts | 2 +- quartz/components/pages/TagContent.tsx | 6 +++--- quartz/plugins/emitters/assets.ts | 2 +- quartz/plugins/emitters/static.ts | 2 +- quartz/plugins/emitters/tagPage.tsx | 4 ++-- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/content/features/private pages.md b/content/features/private pages.md index e225e8c3..9be591b8 100644 --- a/content/features/private pages.md +++ b/content/features/private pages.md @@ -1,5 +1,7 @@ --- title: Private Pages +tags: +- plugin/filter --- There may be some notes you want to avoid publishing as a website. Quartz supports this through two mechanisms which can be used in conjunction: diff --git a/content/features/table of contents.md b/content/features/table of contents.md index ecc36fdc..f0585736 100644 --- a/content/features/table of contents.md +++ b/content/features/table of contents.md @@ -2,7 +2,7 @@ title: "Table of Contents" tags: - component - - plugins/transformer + - plugin/transformer --- Quartz can automatically generate a table of contents from a list of headings on each page. It will also show you your current scroll position on the site by marking headings you've scrolled through with a different colour. diff --git a/quartz.config.ts b/quartz.config.ts index 447039d6..dc9b7d5e 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -9,7 +9,7 @@ const config: QuartzConfig = { analytics: { provider: "plausible", }, - baseUrl: "quartz.jzhao.xyz", + baseUrl: "four.quartz.jzhao.xyz", ignorePatterns: ["private", "templates"], theme: { typography: { diff --git a/quartz/components/pages/TagContent.tsx b/quartz/components/pages/TagContent.tsx index 5300cce4..05aaade1 100644 --- a/quartz/components/pages/TagContent.tsx +++ b/quartz/components/pages/TagContent.tsx @@ -3,7 +3,7 @@ import { Fragment, jsx, jsxs } from "preact/jsx-runtime" import { toJsxRuntime } from "hast-util-to-jsx-runtime" import style from "../styles/listPage.scss" import { PageList } from "../PageList" -import { ServerSlug, canonicalizeServer, getAllSegmentPrefixes } from "../../path" +import { ServerSlug, canonicalizeServer, getAllSegmentPrefixes, joinSegments } from "../../path" import { QuartzPluginData } from "../../plugins/vfile" const numPages = 10 @@ -11,7 +11,7 @@ function TagContent(props: QuartzComponentProps) { const { tree, fileData, allFiles } = props const slug = fileData.slug - if (!slug?.startsWith("tags/")) { + if (!(slug?.startsWith("tags/") || slug === "tags")) { throw new Error(`Component "TagContent" tried to render a non-tag page: ${slug}`) } @@ -44,7 +44,7 @@ function TagContent(props: QuartzComponentProps) { return (

- + #{tag}

diff --git a/quartz/plugins/emitters/assets.ts b/quartz/plugins/emitters/assets.ts index 400c39da..0f7f3e41 100644 --- a/quartz/plugins/emitters/assets.ts +++ b/quartz/plugins/emitters/assets.ts @@ -24,7 +24,7 @@ export const Assets: QuartzEmitterPlugin = () => { const dir = path.dirname(dest) as FilePath await fs.promises.mkdir(dir, { recursive: true }) // ensure dir exists await fs.promises.copyFile(src, dest) - res.push(fp) + res.push(dest) } return res diff --git a/quartz/plugins/emitters/static.ts b/quartz/plugins/emitters/static.ts index 75bcc746..794cbac6 100644 --- a/quartz/plugins/emitters/static.ts +++ b/quartz/plugins/emitters/static.ts @@ -12,6 +12,6 @@ export const Static: QuartzEmitterPlugin = () => ({ const staticPath = joinSegments(QUARTZ, "static") const fps = await glob("**", staticPath, cfg.configuration.ignorePatterns) await fs.promises.cp(staticPath, joinSegments(argv.output, "static"), { recursive: true }) - return fps.map((fp) => joinSegments("static", fp)) as FilePath[] + return fps.map((fp) => joinSegments(argv.output, "static", fp)) as FilePath[] }, }) diff --git a/quartz/plugins/emitters/tagPage.tsx b/quartz/plugins/emitters/tagPage.tsx index 19e2906b..fd00d9c9 100644 --- a/quartz/plugins/emitters/tagPage.tsx +++ b/quartz/plugins/emitters/tagPage.tsx @@ -49,7 +49,7 @@ export const TagPage: QuartzEmitterPlugin = (userOpts) => { return [ tag, defaultProcessedContent({ - slug: joinSegments("tags", tag, "index") as ServerSlug, + slug: joinSegments("tags", tag) as ServerSlug, frontmatter: { title, tags: [] }, }), ] @@ -59,7 +59,7 @@ export const TagPage: QuartzEmitterPlugin = (userOpts) => { for (const [tree, file] of content) { const slug = file.data.slug! if (slug.startsWith("tags/")) { - const tag = joinSegments(slug.slice("tags/".length), "index") + const tag = slug.slice("tags/".length) if (tags.has(tag)) { tagDescriptions[tag] = [tree, file] }