mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-25 22:04:06 -06:00
modify contentPage rather than new plugin
This commit is contained in:
parent
d14dd4e56c
commit
c1182108db
@ -135,6 +135,6 @@ typography: {
|
|||||||
|
|
||||||
The home page is the main web page of your Quartz. The content for the home page lives in `content/index.md`, to change it see [[authoring content|the authoring content guide]].
|
The home page is the main web page of your Quartz. The content for the home page lives in `content/index.md`, to change it see [[authoring content|the authoring content guide]].
|
||||||
|
|
||||||
To enable easy customization, the `homePage` emitter allows you to fully rearrange the layout of the home page. The default home page layout is called `defaultHomePageLayout{:ts}` and can be found in `quartz.layout.ts`. The layout of the home page and all other content pages is the same by default. See [[layout|the layout documentation]] for further guidance.
|
To enable easy customization, Quartz allows you to fully rearrange the layout of the home page. The default home page layout is called `defaultHomePageLayout{:ts}` and can be found in `quartz.layout.ts`. The layout of the home page is the same as all other content pages by default. See [[layout|the layout documentation]] for further guidance on changing the layout.
|
||||||
|
|
||||||
A differnet method is used to configure the comment box on the home page, see [[Comments#Conditionally display comments|conditionally display comments]].
|
A different method is used to configure the comment box on the home page, see [[Comments#Conditionally display comments|conditionally display comments]].
|
||||||
|
|||||||
@ -67,7 +67,7 @@ export const defaultListPageLayout: PageLayout = {
|
|||||||
export const defaultHomePageLayout: HomePageLayout = {
|
export const defaultHomePageLayout: HomePageLayout = {
|
||||||
...sharedPageComponents,
|
...sharedPageComponents,
|
||||||
...defaultContentPageLayout,
|
...defaultContentPageLayout,
|
||||||
// head: Component.Head(),
|
// head: Component.Head(),
|
||||||
// header: [],
|
// header: [],
|
||||||
// left: [],
|
// left: [],
|
||||||
// beforeBody: [],
|
// beforeBody: [],
|
||||||
|
|||||||
@ -10,7 +10,11 @@ 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,
|
||||||
|
sharedPageComponents,
|
||||||
|
defaultHomePageLayout,
|
||||||
|
} 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 +56,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(),
|
||||||
@ -103,7 +107,18 @@ 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
|
||||||
continue
|
opts = {
|
||||||
|
...defaultHomePageLayout,
|
||||||
|
pageBody: Content(),
|
||||||
|
...userOpts,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
opts = {
|
||||||
|
...sharedPageComponents,
|
||||||
|
...defaultContentPageLayout,
|
||||||
|
pageBody: Content(),
|
||||||
|
...userOpts,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.data.slug?.endsWith("/index")) {
|
if (file.data.slug?.endsWith("/index")) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user