From c874e7e9378a5ba895870e9680484fb4af5c6e93 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Sat, 19 Aug 2023 22:52:25 +0000
Subject: [PATCH] base path refactor to better support subpath hosting

---
 quartz/components/PageList.tsx |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/quartz/components/PageList.tsx b/quartz/components/PageList.tsx
index 83b1b07..63513f5 100644
--- a/quartz/components/PageList.tsx
+++ b/quartz/components/PageList.tsx
@@ -1,4 +1,4 @@
-import { CanonicalSlug, canonicalizeServer, resolveRelative } from "../util/path"
+import { FullSlug, resolveRelative } from "../util/path"
 import { QuartzPluginData } from "../plugins/vfile"
 import { Date } from "./Date"
 import { QuartzComponentProps } from "./types"
@@ -25,7 +25,6 @@
 } & QuartzComponentProps
 
 export function PageList({ fileData, allFiles, limit }: Props) {
-  const slug = canonicalizeServer(fileData.slug!)
   let list = allFiles.sort(byDateAndAlphabetical)
   if (limit) {
     list = list.slice(0, limit)
@@ -35,7 +34,6 @@
     <ul class="section-ul">
       {list.map((page) => {
         const title = page.frontmatter?.title
-        const pageSlug = canonicalizeServer(page.slug!)
         const tags = page.frontmatter?.tags ?? []
 
         return (
@@ -48,7 +46,7 @@
               )}
               <div class="desc">
                 <h3>
-                  <a href={resolveRelative(slug, pageSlug)} class="internal">
+                  <a href={resolveRelative(fileData.slug!, page.slug!)} class="internal">
                     {title}
                   </a>
                 </h3>
@@ -58,7 +56,7 @@
                   <li>
                     <a
                       class="internal tag-link"
-                      href={resolveRelative(slug, `tags/${tag}` as CanonicalSlug)}
+                      href={resolveRelative(fileData.slug!, `tags/${tag}/index` as FullSlug)}
                     >
                       #{tag}
                     </a>

--
Gitblit v1.10.0