From 78f4cdbe109308fa33cb87387952aef5a528ebbe Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Sat, 19 Aug 2023 23:40:02 +0000
Subject: [PATCH] avoid 404 on icon for spa navigations with anchors

---
 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 7183acb..d7aca08 100644
--- a/quartz/components/PageList.tsx
+++ b/quartz/components/PageList.tsx
@@ -1,4 +1,4 @@
-import { CanonicalSlug, canonicalizeServer, resolveRelative } from "../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}` as FullSlug)}
                     >
                       #{tag}
                     </a>

--
Gitblit v1.10.0