feat: integrate community PageType plugins (Phase D Step 6)

Replace old page-rendering emitters with PageTypeDispatcher emitter
and pageTypes array. Restructure quartz.layout.ts from three separate
exports to unified layout object with defaults and byPageType record.
Install content-page, folder-page, tag-page community plugins.
This commit is contained in:
saberzero1 2026-02-13 19:35:10 +01:00
parent 17b5c61834
commit 4d47086cab
No known key found for this signature in database
3 changed files with 128 additions and 70 deletions

View File

@ -1,11 +1,8 @@
import { QuartzConfig } from "./quartz/cfg" import { QuartzConfig } from "./quartz/cfg"
import * as Plugin from "./quartz/plugins" 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 = { const config: QuartzConfig = {
configuration: { configuration: {
pageTitle: "Quartz 5", pageTitle: "Quartz 5",
@ -77,9 +74,6 @@ const config: QuartzConfig = {
emitters: [ emitters: [
Plugin.AliasRedirects(), Plugin.AliasRedirects(),
Plugin.ComponentResources(), Plugin.ComponentResources(),
Plugin.ContentPage(),
Plugin.FolderPage(),
Plugin.TagPage(),
Plugin.ContentIndex({ Plugin.ContentIndex({
enableSiteMap: true, enableSiteMap: true,
enableRSS: true, enableRSS: true,
@ -87,10 +81,18 @@ const config: QuartzConfig = {
Plugin.Assets(), Plugin.Assets(),
Plugin.Static(), Plugin.Static(),
Plugin.Favicon(), Plugin.Favicon(),
Plugin.NotFoundPage(), Plugin.PageTypes.PageTypeDispatcher({
// Comment out CustomOgImages to speed up build time defaults: layout.defaults,
byPageType: layout.byPageType,
}),
Plugin.CustomOgImages(), Plugin.CustomOgImages(),
], ],
pageTypes: [
ExternalPlugin.ContentPage(),
ExternalPlugin.FolderPage(),
ExternalPlugin.TagPage(),
Plugin.PageTypes.NotFoundPageType(),
],
}, },
externalPlugins: [ externalPlugins: [
"github:quartz-community/explorer", "github:quartz-community/explorer",
@ -106,6 +108,9 @@ const config: QuartzConfig = {
"github:quartz-community/reader-mode", "github:quartz-community/reader-mode",
"github:quartz-community/content-meta", "github:quartz-community/content-meta",
"github:quartz-community/footer", "github:quartz-community/footer",
"github:quartz-community/content-page",
"github:quartz-community/folder-page",
"github:quartz-community/tag-page",
], ],
} }

View File

@ -1,4 +1,4 @@
import { PageLayout, SharedLayout } from "./quartz/cfg" import { FullPageLayout } from "./quartz/cfg"
import * as Component from "./quartz/components" import * as Component from "./quartz/components"
import * as Plugin from "./.quartz/plugins" import * as Plugin from "./.quartz/plugins"
@ -16,8 +16,12 @@ const darkmodeComponent = Plugin.Darkmode()
const readerModeComponent = Plugin.ReaderMode() const readerModeComponent = Plugin.ReaderMode()
const breadcrumbsComponent = Plugin.Breadcrumbs() const breadcrumbsComponent = Plugin.Breadcrumbs()
// components shared across all pages export const layout: {
export const sharedPageComponents: SharedLayout = { defaults: Partial<FullPageLayout>
byPageType: Record<string, Partial<FullPageLayout>>
} = {
// Components shared across all page types (can be overridden per page type)
defaults: {
head: Component.Head(), head: Component.Head(),
header: [], header: [],
afterBody: [ afterBody: [
@ -31,10 +35,12 @@ export const sharedPageComponents: SharedLayout = {
"Discord Community": "https://discord.gg/cRFFHYye7t", "Discord Community": "https://discord.gg/cRFFHYye7t",
}, },
}), }),
} },
// components for pages that display a single page (e.g. a single note) // Per-page-type layout overrides
export const defaultContentPageLayout: PageLayout = { byPageType: {
// Content pages (single notes)
content: {
beforeBody: [ beforeBody: [
Component.ConditionalRender({ Component.ConditionalRender({
component: breadcrumbsComponent, component: breadcrumbsComponent,
@ -60,10 +66,10 @@ export const defaultContentPageLayout: PageLayout = {
explorerComponent, explorerComponent,
], ],
right: [graphComponent, Component.DesktopOnly(tocComponent), backlinksComponent], right: [graphComponent, Component.DesktopOnly(tocComponent), backlinksComponent],
} },
// components for pages that display lists of pages (e.g. tags or folders) // Folder listing pages
export const defaultListPageLayout: PageLayout = { folder: {
beforeBody: [breadcrumbsComponent, articleTitleComponent, contentMetaComponent], beforeBody: [breadcrumbsComponent, articleTitleComponent, contentMetaComponent],
left: [ left: [
pageTitleComponent, pageTitleComponent,
@ -80,4 +86,33 @@ export const defaultListPageLayout: PageLayout = {
explorerComponent, explorerComponent,
], ],
right: [], right: [],
},
// Tag listing pages
tag: {
beforeBody: [breadcrumbsComponent, articleTitleComponent, contentMetaComponent],
left: [
pageTitleComponent,
Component.MobileOnly(Component.Spacer()),
Component.Flex({
components: [
{
Component: searchComponent,
grow: true,
},
{ Component: darkmodeComponent },
],
}),
explorerComponent,
],
right: [],
},
// 404 page — minimal layout
"404": {
beforeBody: [],
left: [],
right: [],
},
},
} }

View File

@ -96,6 +96,24 @@
"resolved": "https://github.com/quartz-community/footer.git", "resolved": "https://github.com/quartz-community/footer.git",
"commit": "78e3750b3df50a36865f9ba362e7409be6a2c0a3", "commit": "78e3750b3df50a36865f9ba362e7409be6a2c0a3",
"installedAt": "2026-02-13T17:03:00.954Z" "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"
} }
} }
} }