mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-05-18 06:24:22 +02:00
fix: coerce fullslug
Some checks failed
Build and Test / build-and-test (ubuntu-latest) (push) Has been skipped
Build and Test / publish-tag (push) Has been skipped
Build and Test / build-and-test (macos-latest) (push) Has been cancelled
Build and Test / build-and-test (windows-latest) (push) Has been cancelled
Some checks failed
Build and Test / build-and-test (ubuntu-latest) (push) Has been skipped
Build and Test / publish-tag (push) Has been skipped
Build and Test / build-and-test (macos-latest) (push) Has been cancelled
Build and Test / build-and-test (windows-latest) (push) Has been cancelled
This commit is contained in:
parent
c18e6cd5bb
commit
23b691f38c
@ -1,4 +1,4 @@
|
|||||||
import { isRelativeURL, resolveRelative, simplifySlug } from "../../util/path"
|
import { FullSlug, isRelativeURL, resolveRelative, simplifySlug } from "../../util/path"
|
||||||
import { QuartzEmitterPlugin } from "../types"
|
import { QuartzEmitterPlugin } from "../types"
|
||||||
import { write } from "./helpers"
|
import { write } from "./helpers"
|
||||||
import { BuildCtx } from "../../util/ctx"
|
import { BuildCtx } from "../../util/ctx"
|
||||||
@ -9,9 +9,11 @@ async function* processFile(ctx: BuildCtx, file: VFile) {
|
|||||||
const ogSlug = simplifySlug(file.data.slug!)
|
const ogSlug = simplifySlug(file.data.slug!)
|
||||||
|
|
||||||
for (const aliasTarget of file.data.aliases ?? []) {
|
for (const aliasTarget of file.data.aliases ?? []) {
|
||||||
const aliasTargetSlug = isRelativeURL(aliasTarget)
|
const aliasTargetSlug = (
|
||||||
? path.normalize(path.join(ogSlug, "..", aliasTarget))
|
isRelativeURL(aliasTarget)
|
||||||
: aliasTarget
|
? path.normalize(path.join(ogSlug, "..", aliasTarget))
|
||||||
|
: aliasTarget
|
||||||
|
) as FullSlug
|
||||||
|
|
||||||
const redirUrl = resolveRelative(aliasTargetSlug, ogSlug)
|
const redirUrl = resolveRelative(aliasTargetSlug, ogSlug)
|
||||||
yield write({
|
yield write({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user