From 8fd75ffbfda30edd5a134a1fbf9b81ac3cebb2ff Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 24 Jul 2023 00:42:00 +0000
Subject: [PATCH] support attachments folder

---
 quartz/plugins/emitters/aliases.ts |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/quartz/plugins/emitters/aliases.ts b/quartz/plugins/emitters/aliases.ts
index 84ace74..7d2c08a 100644
--- a/quartz/plugins/emitters/aliases.ts
+++ b/quartz/plugins/emitters/aliases.ts
@@ -1,18 +1,24 @@
-import { CanonicalSlug, FilePath, ServerSlug, canonicalizeServer, resolveRelative } from "../../path"
+import {
+  CanonicalSlug,
+  FilePath,
+  ServerSlug,
+  canonicalizeServer,
+  resolveRelative,
+} from "../../path"
 import { QuartzEmitterPlugin } from "../types"
-import path from 'path'
+import path from "path"
 
 export const AliasRedirects: QuartzEmitterPlugin = () => ({
   name: "AliasRedirects",
   getQuartzComponents() {
     return []
   },
-  async emit(contentFolder, _cfg, content, _resources, emit): Promise<FilePath[]> {
+  async emit({ argv }, content, _resources, emit): Promise<FilePath[]> {
     const fps: FilePath[] = []
 
     for (const [_tree, file] of content) {
       const ogSlug = canonicalizeServer(file.data.slug!)
-      const dir = path.relative(contentFolder, file.dirname ?? contentFolder)
+      const dir = path.relative(argv.directory, file.dirname ?? argv.directory)
 
       let aliases: CanonicalSlug[] = []
       if (file.data.frontmatter?.aliases) {
@@ -24,7 +30,7 @@
       for (const alias of aliases) {
         const slug = path.posix.join(dir, alias) as ServerSlug
 
-        const fp = slug + ".html" as FilePath
+        const fp = (slug + ".html") as FilePath
         const redirUrl = resolveRelative(canonicalizeServer(slug), ogSlug)
         await emit({
           content: `
@@ -47,5 +53,5 @@
       }
     }
     return fps
-  }
+  },
 })

--
Gitblit v1.10.0