From 906f91f8eed5e91a7afae95c7002a3e4553d6aae Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Thu, 13 Jul 2023 07:19:35 +0000
Subject: [PATCH] base path refactor, more docs
---
quartz/plugins/emitters/aliases.ts | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/quartz/plugins/emitters/aliases.ts b/quartz/plugins/emitters/aliases.ts
index c9a019b..85681f1 100644
--- a/quartz/plugins/emitters/aliases.ts
+++ b/quartz/plugins/emitters/aliases.ts
@@ -1,4 +1,4 @@
-import { relativeToRoot } from "../../path"
+import { CanonicalSlug, FilePath, ServerSlug, relativeToRoot } from "../../path"
import { QuartzEmitterPlugin } from "../types"
import path from 'path'
@@ -7,14 +7,14 @@
getQuartzComponents() {
return []
},
- async emit(contentFolder, _cfg, content, _resources, emit): Promise<string[]> {
- const fps: string[] = []
+ async emit(contentFolder, _cfg, content, _resources, emit): Promise<FilePath[]> {
+ const fps: FilePath[] = []
for (const [_tree, file] of content) {
const ogSlug = file.data.slug!
const dir = path.relative(contentFolder, file.dirname ?? contentFolder)
- let aliases: string[] = []
+ let aliases: CanonicalSlug[] = []
if (file.data.frontmatter?.aliases) {
aliases = file.data.frontmatter?.aliases
} else if (file.data.frontmatter?.alias) {
@@ -22,11 +22,11 @@
}
for (const alias of aliases) {
- const slug = alias.startsWith("/")
+ const slug = (alias.startsWith("/")
? alias
- : path.posix.join(dir, alias)
+ : path.posix.join(dir, alias)) as ServerSlug
- const fp = slug + ".html"
+ const fp = slug + ".html" as FilePath
const redirUrl = relativeToRoot(slug, ogSlug)
await emit({
content: `
--
Gitblit v1.10.0