File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1- import { resolveRelative , simplifySlug } from "../../util/path"
1+ import { isRelativeURL , resolveRelative , simplifySlug } from "../../util/path"
22import { QuartzEmitterPlugin } from "../types"
33import { write } from "./helpers"
44import { BuildCtx } from "../../util/ctx"
55import { VFile } from "vfile"
6+ import path from "path"
67
78async function * processFile ( ctx : BuildCtx , file : VFile ) {
89 const ogSlug = simplifySlug ( file . data . slug ! )
910
10- for ( const slug of file . data . aliases ?? [ ] ) {
11- const redirUrl = resolveRelative ( slug , file . data . slug ! )
11+ for ( const aliasTarget of file . data . aliases ?? [ ] ) {
12+ const aliasTargetSlug = isRelativeURL ( aliasTarget )
13+ ? path . normalize ( path . join ( ogSlug , ".." , aliasTarget ) )
14+ : aliasTarget
15+
16+ const redirUrl = resolveRelative ( aliasTargetSlug , ogSlug )
1217 yield write ( {
1318 ctx,
1419 content : `
@@ -23,7 +28,7 @@ async function* processFile(ctx: BuildCtx, file: VFile) {
2328 </head>
2429 </html>
2530 ` ,
26- slug,
31+ slug : aliasTargetSlug ,
2732 ext : ".html" ,
2833 } )
2934 }
You can’t perform that action at this time.
0 commit comments