mirror of
https://github.com/alrayyes/wiki.git
synced 2025-06-08 06:36:40 +00:00
finish path refactoring, add sourcemap + better trace support
This commit is contained in:
parent
906f91f8ee
commit
3ac6b42e16
36 changed files with 331 additions and 1170 deletions
quartz/plugins/emitters
|
@ -1,4 +1,4 @@
|
|||
import { CanonicalSlug, FilePath, ServerSlug, relativeToRoot } from "../../path"
|
||||
import { CanonicalSlug, FilePath, ServerSlug, canonicalizeServer, resolveRelative } from "../../path"
|
||||
import { QuartzEmitterPlugin } from "../types"
|
||||
import path from 'path'
|
||||
|
||||
|
@ -11,7 +11,7 @@ export const AliasRedirects: QuartzEmitterPlugin = () => ({
|
|||
const fps: FilePath[] = []
|
||||
|
||||
for (const [_tree, file] of content) {
|
||||
const ogSlug = file.data.slug!
|
||||
const ogSlug = canonicalizeServer(file.data.slug!)
|
||||
const dir = path.relative(contentFolder, file.dirname ?? contentFolder)
|
||||
|
||||
let aliases: CanonicalSlug[] = []
|
||||
|
@ -22,12 +22,10 @@ export const AliasRedirects: QuartzEmitterPlugin = () => ({
|
|||
}
|
||||
|
||||
for (const alias of aliases) {
|
||||
const slug = (alias.startsWith("/")
|
||||
? alias
|
||||
: path.posix.join(dir, alias)) as ServerSlug
|
||||
const slug = path.posix.join(dir, alias) as ServerSlug
|
||||
|
||||
const fp = slug + ".html" as FilePath
|
||||
const redirUrl = relativeToRoot(slug, ogSlug)
|
||||
const redirUrl = resolveRelative(canonicalizeServer(slug), ogSlug)
|
||||
await emit({
|
||||
content: `
|
||||
<!DOCTYPE html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue