feat(layout): add afterBody
| | |
| | | ...defaultContentPageLayout, |
| | | pageBody: Content(), |
| | | } |
| | | const { head, header, beforeBody, pageBody, left, right, footer } = layout |
| | | const { head, header, beforeBody, pageBody, afterBody, left, right, footer } = layout |
| | | return { |
| | | name: "ContentPage", |
| | | getQuartzComponents() { |
| | | return [head, ...header, ...beforeBody, pageBody, ...left, ...right, footer] |
| | | return [head, ...header, ...beforeBody, pageBody, ...afterBody, ...left, ...right, footer] |
| | | }, |
| | | async emit(ctx, content, resources, emit): Promise<FilePath[]> { |
| | | const cfg = ctx.cfg.configuration |
| | |
| | | header: QuartzComponent[] // laid out horizontally |
| | | beforeBody: QuartzComponent[] // laid out vertically |
| | | pageBody: QuartzComponent // single component |
| | | afterBody: QuartzComponent[] // laid out vertically |
| | | left: QuartzComponent[] // vertical on desktop, horizontal on mobile |
| | | right: QuartzComponent[] // vertical on desktop, horizontal on mobile |
| | | footer: QuartzComponent // single component |
| | |
| | | export const sharedPageComponents: SharedLayout = { |
| | | head: Component.Head(), |
| | | header: [], |
| | | afterBody: [], |
| | | footer: Component.Footer({ |
| | | links: { |
| | | GitHub: "https://github.com/jackyzha0/quartz", |
| | |
| | | header: QuartzComponent[] |
| | | beforeBody: QuartzComponent[] |
| | | pageBody: QuartzComponent |
| | | afterBody: QuartzComponent[] |
| | | left: QuartzComponent[] |
| | | right: QuartzComponent[] |
| | | footer: QuartzComponent |
| | | } |
| | | |
| | | export type PageLayout = Pick<FullPageLayout, "beforeBody" | "left" | "right"> |
| | | export type SharedLayout = Pick<FullPageLayout, "head" | "header" | "footer"> |
| | | export type SharedLayout = Pick<FullPageLayout, "head" | "header" | "footer" | "afterBody"> |
| | |
| | | const links = opts?.links ?? [] |
| | | return ( |
| | | <footer class={`${displayClass ?? ""}`}> |
| | | <hr /> |
| | | <p> |
| | | {i18n(cfg.locale).components.footer.createdWith}{" "} |
| | | <a href="https://quartz.jzhao.xyz/">Quartz v{version}</a> © {year} |
| | |
| | | header: QuartzComponent[] |
| | | beforeBody: QuartzComponent[] |
| | | pageBody: QuartzComponent |
| | | afterBody: QuartzComponent[] |
| | | left: QuartzComponent[] |
| | | right: QuartzComponent[] |
| | | footer: QuartzComponent |
| | |
| | | header, |
| | | beforeBody, |
| | | pageBody: Content, |
| | | afterBody, |
| | | left, |
| | | right, |
| | | footer: Footer, |
| | |
| | | </div> |
| | | </div> |
| | | <Content {...componentData} /> |
| | | <hr /> |
| | | <div class="page-footer"> |
| | | {afterBody.map((BodyComponent) => ( |
| | | <BodyComponent {...componentData} /> |
| | | ))} |
| | | </div> |
| | | </div> |
| | | {RightComponent} |
| | | </Body> |
| | |
| | | ...userOpts, |
| | | } |
| | | |
| | | const { head: Head, header, beforeBody, pageBody, left, right, footer: Footer } = opts |
| | | const { head: Head, header, beforeBody, pageBody, afterBody, left, right, footer: Footer } = opts |
| | | const Header = HeaderConstructor() |
| | | const Body = BodyConstructor() |
| | | |
| | | return { |
| | | name: "ContentPage", |
| | | getQuartzComponents() { |
| | | return [Head, Header, Body, ...header, ...beforeBody, pageBody, ...left, ...right, Footer] |
| | | return [ |
| | | Head, |
| | | Header, |
| | | Body, |
| | | ...header, |
| | | ...beforeBody, |
| | | pageBody, |
| | | ...afterBody, |
| | | ...left, |
| | | ...right, |
| | | Footer, |
| | | ] |
| | | }, |
| | | async getDependencyGraph(ctx, content, _resources) { |
| | | const graph = new DepGraph<FilePath>() |
| | |
| | | ...userOpts, |
| | | } |
| | | |
| | | const { head: Head, header, beforeBody, pageBody, left, right, footer: Footer } = opts |
| | | const { head: Head, header, beforeBody, pageBody, afterBody, left, right, footer: Footer } = opts |
| | | const Header = HeaderConstructor() |
| | | const Body = BodyConstructor() |
| | | |
| | | return { |
| | | name: "FolderPage", |
| | | getQuartzComponents() { |
| | | return [Head, Header, Body, ...header, ...beforeBody, pageBody, ...left, ...right, Footer] |
| | | return [ |
| | | Head, |
| | | Header, |
| | | Body, |
| | | ...header, |
| | | ...beforeBody, |
| | | pageBody, |
| | | ...afterBody, |
| | | ...left, |
| | | ...right, |
| | | Footer, |
| | | ] |
| | | }, |
| | | async getDependencyGraph(_ctx, content, _resources) { |
| | | // Example graph: |
| | |
| | | ...userOpts, |
| | | } |
| | | |
| | | const { head: Head, header, beforeBody, pageBody, left, right, footer: Footer } = opts |
| | | const { head: Head, header, beforeBody, pageBody, afterBody, left, right, footer: Footer } = opts |
| | | const Header = HeaderConstructor() |
| | | const Body = BodyConstructor() |
| | | |
| | | return { |
| | | name: "TagPage", |
| | | getQuartzComponents() { |
| | | return [Head, Header, Body, ...header, ...beforeBody, pageBody, ...left, ...right, Footer] |
| | | return [ |
| | | Head, |
| | | Header, |
| | | Body, |
| | | ...header, |
| | | ...beforeBody, |
| | | pageBody, |
| | | ...afterBody, |
| | | ...left, |
| | | ...right, |
| | | Footer, |
| | | ] |
| | | }, |
| | | async getDependencyGraph(ctx, content, _resources) { |
| | | const graph = new DepGraph<FilePath>() |
| | |
| | | import { Root, Html, BlockContent, DefinitionContent, Paragraph, Code } from "mdast" |
| | | import { Element, Literal, Root as HtmlRoot } from "hast" |
| | | import { ReplaceFunction, findAndReplace as mdastFindReplace } from "mdast-util-find-and-replace" |
| | | import { slug as slugAnchor } from "github-slugger" |
| | | import rehypeRaw from "rehype-raw" |
| | | import { SKIP, visit } from "unist-util-visit" |
| | | import path from "path" |
| | |
| | | } |
| | | } |
| | | |
| | | & .page-header { |
| | | & .page-header, |
| | | & .page-footer { |
| | | width: $pageWidth; |
| | | margin: $topSpacing auto 0 auto; |
| | | margin-top: 1rem; |
| | | |
| | | @media all and (max-width: $fullPageWidth) { |
| | | width: initial; |
| | | } |
| | | } |
| | | |
| | | & .page-header { |
| | | margin: $topSpacing auto 0 auto; |
| | | @media all and (max-width: $fullPageWidth) { |
| | | margin-top: 2rem; |
| | | } |
| | | } |