mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-01 22:48:14 +00:00
docs on making plugins
This commit is contained in:
parent
ad3f7b2d5f
commit
cefbca4753
11 changed files with 330 additions and 43 deletions
quartz/plugins/emitters
|
@ -30,9 +30,8 @@ export const AliasRedirects: QuartzEmitterPlugin = () => ({
|
|||
for (const alias of aliases) {
|
||||
const slug = path.posix.join(dir, alias) as ServerSlug
|
||||
|
||||
const fp = (slug + ".html") as FilePath
|
||||
const redirUrl = resolveRelative(canonicalizeServer(slug), ogSlug)
|
||||
await emit({
|
||||
const fp = await emit({
|
||||
content: `
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
|
|
|
@ -98,7 +98,6 @@ function addGlobalPageResources(
|
|||
componentResources.afterDOMLoaded.push(plausibleScript)
|
||||
}
|
||||
|
||||
// spa
|
||||
if (cfg.enableSPA) {
|
||||
componentResources.afterDOMLoaded.push(spaRouterScript)
|
||||
} else {
|
||||
|
|
|
@ -88,21 +88,19 @@ export const ContentIndex: QuartzEmitterPlugin<Partial<Options>> = (opts) => {
|
|||
}
|
||||
|
||||
if (opts?.enableSiteMap) {
|
||||
await emit({
|
||||
emitted.push(await emit({
|
||||
content: generateSiteMap(cfg, linkIndex),
|
||||
slug: "sitemap" as ServerSlug,
|
||||
ext: ".xml",
|
||||
})
|
||||
emitted.push("sitemap.xml" as FilePath)
|
||||
}))
|
||||
}
|
||||
|
||||
if (opts?.enableRSS) {
|
||||
await emit({
|
||||
emitted.push(await emit({
|
||||
content: generateRSSFeed(cfg, linkIndex),
|
||||
slug: "index" as ServerSlug,
|
||||
ext: ".xml",
|
||||
})
|
||||
emitted.push("index.xml" as FilePath)
|
||||
}))
|
||||
}
|
||||
|
||||
const fp = path.join("static", "contentIndex") as ServerSlug
|
||||
|
@ -117,12 +115,11 @@ export const ContentIndex: QuartzEmitterPlugin<Partial<Options>> = (opts) => {
|
|||
}),
|
||||
)
|
||||
|
||||
await emit({
|
||||
emitted.push(await emit({
|
||||
content: JSON.stringify(simplifiedIndex),
|
||||
slug: fp,
|
||||
ext: ".json",
|
||||
})
|
||||
emitted.push(`${fp}.json` as FilePath)
|
||||
}))
|
||||
|
||||
return emitted
|
||||
},
|
||||
|
|
|
@ -42,9 +42,7 @@ export const ContentPage: QuartzEmitterPlugin<Partial<FullPageLayout>> = (userOp
|
|||
}
|
||||
|
||||
const content = renderPage(slug, componentData, opts, externalResources)
|
||||
|
||||
const fp = (file.data.slug + ".html") as FilePath
|
||||
await emit({
|
||||
const fp = await emit({
|
||||
content,
|
||||
slug: file.data.slug!,
|
||||
ext: ".html",
|
||||
|
|
|
@ -74,9 +74,7 @@ export const FolderPage: QuartzEmitterPlugin<FullPageLayout> = (userOpts) => {
|
|||
}
|
||||
|
||||
const content = renderPage(slug, componentData, opts, externalResources)
|
||||
|
||||
const fp = (file.data.slug! + ".html") as FilePath
|
||||
await emit({
|
||||
const fp = await emit({
|
||||
content,
|
||||
slug: file.data.slug!,
|
||||
ext: ".html",
|
||||
|
|
|
@ -80,9 +80,7 @@ export const TagPage: QuartzEmitterPlugin<FullPageLayout> = (userOpts) => {
|
|||
}
|
||||
|
||||
const content = renderPage(slug, componentData, opts, externalResources)
|
||||
|
||||
const fp = (file.data.slug + ".html") as FilePath
|
||||
await emit({
|
||||
const fp = await emit({
|
||||
content,
|
||||
slug: file.data.slug!,
|
||||
ext: ".html",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue