mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-21 21:45:42 -05:00
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:
parent
17b5c61834
commit
4d47086cab
@ -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",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
155
quartz.layout.ts
155
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 Component from "./quartz/components"
|
||||||
import * as Plugin from "./.quartz/plugins"
|
import * as Plugin from "./.quartz/plugins"
|
||||||
|
|
||||||
@ -16,68 +16,103 @@ 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>
|
||||||
head: Component.Head(),
|
byPageType: Record<string, Partial<FullPageLayout>>
|
||||||
header: [],
|
} = {
|
||||||
afterBody: [
|
// Components shared across all page types (can be overridden per page type)
|
||||||
// Plugin.Comments({
|
defaults: {
|
||||||
// provider: "giscus",
|
head: Component.Head(),
|
||||||
// options: {}}),
|
header: [],
|
||||||
],
|
afterBody: [
|
||||||
footer: Plugin.Footer({
|
// Plugin.Comments({
|
||||||
links: {
|
// provider: "giscus",
|
||||||
GitHub: "https://github.com/jackyzha0/quartz",
|
// options: {}}),
|
||||||
"Discord Community": "https://discord.gg/cRFFHYye7t",
|
],
|
||||||
|
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)
|
// Folder listing pages
|
||||||
export const defaultContentPageLayout: PageLayout = {
|
folder: {
|
||||||
beforeBody: [
|
beforeBody: [breadcrumbsComponent, articleTitleComponent, contentMetaComponent],
|
||||||
Component.ConditionalRender({
|
left: [
|
||||||
component: breadcrumbsComponent,
|
pageTitleComponent,
|
||||||
condition: (page) => page.fileData.slug !== "index",
|
Component.MobileOnly(Component.Spacer()),
|
||||||
}),
|
Component.Flex({
|
||||||
articleTitleComponent,
|
components: [
|
||||||
contentMetaComponent,
|
{
|
||||||
tagListComponent,
|
Component: searchComponent,
|
||||||
],
|
grow: true,
|
||||||
left: [
|
},
|
||||||
pageTitleComponent,
|
{ Component: darkmodeComponent },
|
||||||
Component.MobileOnly(Component.Spacer()),
|
],
|
||||||
Component.Flex({
|
}),
|
||||||
components: [
|
explorerComponent,
|
||||||
{
|
|
||||||
Component: searchComponent,
|
|
||||||
grow: true,
|
|
||||||
},
|
|
||||||
{ Component: darkmodeComponent },
|
|
||||||
{ Component: readerModeComponent },
|
|
||||||
],
|
],
|
||||||
}),
|
right: [],
|
||||||
explorerComponent,
|
},
|
||||||
],
|
|
||||||
right: [graphComponent, Component.DesktopOnly(tocComponent), backlinksComponent],
|
|
||||||
}
|
|
||||||
|
|
||||||
// components for pages that display lists of pages (e.g. tags or folders)
|
// Tag listing pages
|
||||||
export const defaultListPageLayout: PageLayout = {
|
tag: {
|
||||||
beforeBody: [breadcrumbsComponent, articleTitleComponent, contentMetaComponent],
|
beforeBody: [breadcrumbsComponent, articleTitleComponent, contentMetaComponent],
|
||||||
left: [
|
left: [
|
||||||
pageTitleComponent,
|
pageTitleComponent,
|
||||||
Component.MobileOnly(Component.Spacer()),
|
Component.MobileOnly(Component.Spacer()),
|
||||||
Component.Flex({
|
Component.Flex({
|
||||||
components: [
|
components: [
|
||||||
{
|
{
|
||||||
Component: searchComponent,
|
Component: searchComponent,
|
||||||
grow: true,
|
grow: true,
|
||||||
},
|
},
|
||||||
{ Component: darkmodeComponent },
|
{ Component: darkmodeComponent },
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
explorerComponent,
|
||||||
],
|
],
|
||||||
}),
|
right: [],
|
||||||
explorerComponent,
|
},
|
||||||
],
|
|
||||||
right: [],
|
// 404 page — minimal layout
|
||||||
|
"404": {
|
||||||
|
beforeBody: [],
|
||||||
|
left: [],
|
||||||
|
right: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user