diff --git a/quartz.config.ts b/quartz.config.ts index 8ee93dd97..56456ce8d 100644 --- a/quartz.config.ts +++ b/quartz.config.ts @@ -1,11 +1,8 @@ import { QuartzConfig } from "./quartz/cfg" import * as Plugin from "./quartz/plugins" +import * as ExternalPlugin from "./.quartz/plugins" +import { layout } from "./quartz.layout" -/** - * Quartz 5 Configuration - * - * See https://quartz.jzhao.xyz/configuration for more information. - */ const config: QuartzConfig = { configuration: { pageTitle: "Quartz 5", @@ -77,9 +74,6 @@ const config: QuartzConfig = { emitters: [ Plugin.AliasRedirects(), Plugin.ComponentResources(), - Plugin.ContentPage(), - Plugin.FolderPage(), - Plugin.TagPage(), Plugin.ContentIndex({ enableSiteMap: true, enableRSS: true, @@ -87,10 +81,18 @@ const config: QuartzConfig = { Plugin.Assets(), Plugin.Static(), Plugin.Favicon(), - Plugin.NotFoundPage(), - // Comment out CustomOgImages to speed up build time + Plugin.PageTypes.PageTypeDispatcher({ + defaults: layout.defaults, + byPageType: layout.byPageType, + }), Plugin.CustomOgImages(), ], + pageTypes: [ + ExternalPlugin.ContentPage(), + ExternalPlugin.FolderPage(), + ExternalPlugin.TagPage(), + Plugin.PageTypes.NotFoundPageType(), + ], }, externalPlugins: [ "github:quartz-community/explorer", @@ -106,6 +108,9 @@ const config: QuartzConfig = { "github:quartz-community/reader-mode", "github:quartz-community/content-meta", "github:quartz-community/footer", + "github:quartz-community/content-page", + "github:quartz-community/folder-page", + "github:quartz-community/tag-page", ], } diff --git a/quartz.layout.ts b/quartz.layout.ts index d6e8e2a23..b55569e16 100644 --- a/quartz.layout.ts +++ b/quartz.layout.ts @@ -1,4 +1,4 @@ -import { PageLayout, SharedLayout } from "./quartz/cfg" +import { FullPageLayout } from "./quartz/cfg" import * as Component from "./quartz/components" import * as Plugin from "./.quartz/plugins" @@ -16,68 +16,103 @@ const darkmodeComponent = Plugin.Darkmode() const readerModeComponent = Plugin.ReaderMode() const breadcrumbsComponent = Plugin.Breadcrumbs() -// components shared across all pages -export const sharedPageComponents: SharedLayout = { - head: Component.Head(), - header: [], - afterBody: [ - // Plugin.Comments({ - // provider: "giscus", - // options: {}}), - ], - footer: Plugin.Footer({ - links: { - GitHub: "https://github.com/jackyzha0/quartz", - "Discord Community": "https://discord.gg/cRFFHYye7t", +export const layout: { + defaults: Partial + byPageType: Record> +} = { + // Components shared across all page types (can be overridden per page type) + defaults: { + head: Component.Head(), + header: [], + afterBody: [ + // Plugin.Comments({ + // provider: "giscus", + // options: {}}), + ], + footer: Plugin.Footer({ + links: { + GitHub: "https://github.com/jackyzha0/quartz", + "Discord Community": "https://discord.gg/cRFFHYye7t", + }, + }), + }, + + // Per-page-type layout overrides + byPageType: { + // Content pages (single notes) + content: { + beforeBody: [ + Component.ConditionalRender({ + component: breadcrumbsComponent, + condition: (page) => page.fileData.slug !== "index", + }), + articleTitleComponent, + contentMetaComponent, + tagListComponent, + ], + left: [ + pageTitleComponent, + Component.MobileOnly(Component.Spacer()), + Component.Flex({ + components: [ + { + Component: searchComponent, + grow: true, + }, + { Component: darkmodeComponent }, + { Component: readerModeComponent }, + ], + }), + explorerComponent, + ], + right: [graphComponent, Component.DesktopOnly(tocComponent), backlinksComponent], }, - }), -} -// components for pages that display a single page (e.g. a single note) -export const defaultContentPageLayout: PageLayout = { - beforeBody: [ - Component.ConditionalRender({ - component: breadcrumbsComponent, - condition: (page) => page.fileData.slug !== "index", - }), - articleTitleComponent, - contentMetaComponent, - tagListComponent, - ], - left: [ - pageTitleComponent, - Component.MobileOnly(Component.Spacer()), - Component.Flex({ - components: [ - { - Component: searchComponent, - grow: true, - }, - { Component: darkmodeComponent }, - { Component: readerModeComponent }, + // Folder listing pages + folder: { + beforeBody: [breadcrumbsComponent, articleTitleComponent, contentMetaComponent], + left: [ + pageTitleComponent, + Component.MobileOnly(Component.Spacer()), + Component.Flex({ + components: [ + { + Component: searchComponent, + grow: true, + }, + { Component: darkmodeComponent }, + ], + }), + explorerComponent, ], - }), - explorerComponent, - ], - right: [graphComponent, Component.DesktopOnly(tocComponent), backlinksComponent], -} + right: [], + }, -// components for pages that display lists of pages (e.g. tags or folders) -export const defaultListPageLayout: PageLayout = { - beforeBody: [breadcrumbsComponent, articleTitleComponent, contentMetaComponent], - left: [ - pageTitleComponent, - Component.MobileOnly(Component.Spacer()), - Component.Flex({ - components: [ - { - Component: searchComponent, - grow: true, - }, - { Component: darkmodeComponent }, + // Tag listing pages + tag: { + beforeBody: [breadcrumbsComponent, articleTitleComponent, contentMetaComponent], + left: [ + pageTitleComponent, + Component.MobileOnly(Component.Spacer()), + Component.Flex({ + components: [ + { + Component: searchComponent, + grow: true, + }, + { Component: darkmodeComponent }, + ], + }), + explorerComponent, ], - }), - explorerComponent, - ], - right: [], + right: [], + }, + + // 404 page — minimal layout + "404": { + beforeBody: [], + left: [], + right: [], + }, + }, } diff --git a/quartz.lock.json b/quartz.lock.json index 7c681fffe..fb151fc48 100644 --- a/quartz.lock.json +++ b/quartz.lock.json @@ -96,6 +96,24 @@ "resolved": "https://github.com/quartz-community/footer.git", "commit": "78e3750b3df50a36865f9ba362e7409be6a2c0a3", "installedAt": "2026-02-13T17:03:00.954Z" + }, + "content-page": { + "source": "github:quartz-community/content-page", + "resolved": "https://github.com/quartz-community/content-page.git", + "commit": "27ae3160f1076e630a2160885515fb81fb67a8e8", + "installedAt": "2026-02-13T18:15:53.092Z" + }, + "folder-page": { + "source": "github:quartz-community/folder-page", + "resolved": "https://github.com/quartz-community/folder-page.git", + "commit": "0006bfc868fc78dda8ea35fb502634ba5c5e001f", + "installedAt": "2026-02-13T18:15:53.787Z" + }, + "tag-page": { + "source": "github:quartz-community/tag-page", + "resolved": "https://github.com/quartz-community/tag-page.git", + "commit": "848d06a6c90b85759e4c1df6fcae885134281ef7", + "installedAt": "2026-02-13T18:15:54.453Z" } } }