base path refactor to better support subpath hosting
This commit is contained in:
@ -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 @@ type Props = {
|
||||
} & 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 @@ export function PageList({ fileData, allFiles, limit }: Props) {
|
||||
<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 @@ export function PageList({ fileData, allFiles, limit }: Props) {
|
||||
)}
|
||||
<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 @@ export function PageList({ fileData, allFiles, limit }: Props) {
|
||||
<li>
|
||||
<a
|
||||
class="internal tag-link"
|
||||
href={resolveRelative(slug, `tags/${tag}` as CanonicalSlug)}
|
||||
href={resolveRelative(fileData.slug!, `tags/${tag}/index` as FullSlug)}
|
||||
>
|
||||
#{tag}
|
||||
</a>
|
||||
|
Reference in New Issue
Block a user