fix: add a trailing slash for folders to enforce intended behavior on github pages hosted sites

This commit is contained in:
Antoine Déchappe 2024-12-27 15:40:49 +01:00
parent 99011cb1b0
commit d66c251a8c

View File

@ -42,6 +42,8 @@ export const PageList: QuartzComponent = ({ cfg, fileData, allFiles, limit, sort
{list.map((page) => {
const title = page.frontmatter?.title
const tags = page.frontmatter?.tags ?? []
const isFolder = tags.includes("folder")
const href = resolveRelative(fileData.slug!, page.slug!) + (isFolder ? "/" : "")
return (
<li class="section-li">
@ -51,7 +53,7 @@ export const PageList: QuartzComponent = ({ cfg, fileData, allFiles, limit, sort
</p>
<div class="desc">
<h3>
<a href={resolveRelative(fileData.slug!, page.slug!)} class="internal">
<a href={href} class="internal">
{title}
</a>
</h3>