From 995a5986a77f7e10fc10ecdafa367f8272af18ae Mon Sep 17 00:00:00 2001 From: saberzero1 Date: Sat, 28 Feb 2026 04:31:17 +0100 Subject: [PATCH] feat: integrate PageFrame into rendering pipeline --- quartz/cfg.ts | 2 ++ quartz/components/renderPage.tsx | 59 +++++++++----------------------- quartz/plugins/types.ts | 4 +++ 3 files changed, 22 insertions(+), 43 deletions(-) diff --git a/quartz/cfg.ts b/quartz/cfg.ts index e7de5b244..bdb8ef1d7 100644 --- a/quartz/cfg.ts +++ b/quartz/cfg.ts @@ -101,6 +101,8 @@ export interface FullPageLayout { left: QuartzComponent[] right: QuartzComponent[] footer: QuartzComponent + /** Page frame name (e.g. "default", "full-width", "minimal"). Defaults to "default". */ + frame?: string } export type PageLayout = Pick diff --git a/quartz/components/renderPage.tsx b/quartz/components/renderPage.tsx index 5907967bb..84e649cec 100644 --- a/quartz/components/renderPage.tsx +++ b/quartz/components/renderPage.tsx @@ -1,6 +1,5 @@ import { render } from "preact-render-to-string" import { QuartzComponent, QuartzComponentProps } from "./types" -import HeaderConstructor from "./Header" import BodyConstructor from "./Body" import { JSResourceToScriptElement, StaticResources } from "../util/resources" import { FullSlug, RelativeURL, joinSegments, normalizeHastElement } from "../util/path" @@ -10,6 +9,7 @@ import { Root, Element, ElementContent } from "hast" import { GlobalConfiguration } from "../cfg" import { i18n } from "../i18n" import { styleText } from "util" +import { resolveFrame } from "./frames" interface RenderComponents { head: QuartzComponent @@ -20,6 +20,7 @@ interface RenderComponents { left: QuartzComponent[] right: QuartzComponent[] footer: QuartzComponent + frame?: string } const headerRegex = new RegExp(/h[1-6]/) @@ -249,25 +250,10 @@ export function renderPage( left, right, footer: Footer, + frame: frameName, } = components - const Header = HeaderConstructor() const Body = BodyConstructor() - - const LeftComponent = ( - - ) - - const RightComponent = ( - - ) + const frame = resolveFrame(frameName) const lang = componentData.fileData.frontmatter?.lang ?? cfg.locale?.split("-")[0] ?? "en" const direction = i18n(cfg.locale).direction ?? "ltr" @@ -275,32 +261,19 @@ export function renderPage( -
+
- {LeftComponent} -
- - -
- -
- {RightComponent} -
diff --git a/quartz/plugins/types.ts b/quartz/plugins/types.ts index 5694fbb69..5e1cb0fd6 100644 --- a/quartz/plugins/types.ts +++ b/quartz/plugins/types.ts @@ -101,6 +101,8 @@ export interface QuartzPageTypePluginInstance { match: PageMatcher generate?: PageGenerator layout: string + /** Optional page frame name (e.g. "default", "full-width", "minimal"). Defaults to "default". */ + frame?: string body: QuartzComponentConstructor } @@ -117,5 +119,7 @@ export interface PageTypePluginEntry { match: (...args: never[]) => boolean generate?: (...args: never[]) => VirtualPage[] layout: string + /** Optional page frame name (e.g. "default", "full-width", "minimal"). Defaults to "default". */ + frame?: string body: QuartzComponentConstructor }