mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
feat: add component customisation options for the index page
This commit is contained in:
parent
a201105442
commit
5db049e856
@ -36,6 +36,11 @@ export const defaultContentPageLayout: PageLayout = {
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// components for the index page
|
||||||
|
export const indexContentPageLayout: PageLayout = {
|
||||||
|
...defaultContentPageLayout
|
||||||
|
}
|
||||||
|
|
||||||
// components for pages that display lists of pages (e.g. tags or folders)
|
// components for pages that display lists of pages (e.g. tags or folders)
|
||||||
export const defaultListPageLayout: PageLayout = {
|
export const defaultListPageLayout: PageLayout = {
|
||||||
beforeBody: [Component.Breadcrumbs(), Component.ArticleTitle(), Component.ContentMeta()],
|
beforeBody: [Component.Breadcrumbs(), Component.ArticleTitle(), Component.ContentMeta()],
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { pageResources, renderPage } from "../../components/renderPage"
|
|||||||
import { FullPageLayout } from "../../cfg"
|
import { FullPageLayout } from "../../cfg"
|
||||||
import { Argv } from "../../util/ctx"
|
import { Argv } from "../../util/ctx"
|
||||||
import { FilePath, isRelativeURL, joinSegments, pathToRoot } from "../../util/path"
|
import { FilePath, isRelativeURL, joinSegments, pathToRoot } from "../../util/path"
|
||||||
import { defaultContentPageLayout, sharedPageComponents } from "../../../quartz.layout"
|
import { defaultContentPageLayout, indexContentPageLayout, sharedPageComponents } from "../../../quartz.layout"
|
||||||
import { Content } from "../../components"
|
import { Content } from "../../components"
|
||||||
import chalk from "chalk"
|
import chalk from "chalk"
|
||||||
import { write } from "./helpers"
|
import { write } from "./helpers"
|
||||||
@ -52,7 +52,7 @@ const parseDependencies = (argv: Argv, hast: Root, file: VFile): string[] => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ContentPage: QuartzEmitterPlugin<Partial<FullPageLayout>> = (userOpts) => {
|
export const ContentPage: QuartzEmitterPlugin<Partial<FullPageLayout>> = (userOpts) => {
|
||||||
const opts: FullPageLayout = {
|
let opts: FullPageLayout = {
|
||||||
...sharedPageComponents,
|
...sharedPageComponents,
|
||||||
...defaultContentPageLayout,
|
...defaultContentPageLayout,
|
||||||
pageBody: Content(),
|
pageBody: Content(),
|
||||||
@ -104,6 +104,12 @@ export const ContentPage: QuartzEmitterPlugin<Partial<FullPageLayout>> = (userOp
|
|||||||
const slug = file.data.slug!
|
const slug = file.data.slug!
|
||||||
if (slug === "index") {
|
if (slug === "index") {
|
||||||
containsIndex = true
|
containsIndex = true
|
||||||
|
opts = {
|
||||||
|
...sharedPageComponents,
|
||||||
|
...indexContentPageLayout,
|
||||||
|
pageBody: Content(),
|
||||||
|
...userOpts,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const externalResources = pageResources(pathToRoot(slug), file.data, resources)
|
const externalResources = pageResources(pathToRoot(slug), file.data, resources)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user