From 0c199975f2d469ecdfd7efcf2ddd16ffa1dc492b Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Thu, 17 Aug 2023 07:55:28 +0000
Subject: [PATCH] various path fixes for links to extensions, fix relative paths in links
---
quartz/components/PageList.tsx | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/quartz/components/PageList.tsx b/quartz/components/PageList.tsx
index 2f08f62..83b1b07 100644
--- a/quartz/components/PageList.tsx
+++ b/quartz/components/PageList.tsx
@@ -1,4 +1,4 @@
-import { CanonicalSlug, canonicalizeServer, resolveRelative } from "../path"
+import { CanonicalSlug, canonicalizeServer, resolveRelative } from "../util/path"
import { QuartzPluginData } from "../plugins/vfile"
import { Date } from "./Date"
import { QuartzComponentProps } from "./types"
@@ -20,11 +20,20 @@
return f1Title.localeCompare(f2Title)
}
-export function PageList({ fileData, allFiles }: QuartzComponentProps) {
+type Props = {
+ limit?: number
+} & 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)
+ }
+
return (
<ul class="section-ul">
- {allFiles.sort(byDateAndAlphabetical).map((page) => {
+ {list.map((page) => {
const title = page.frontmatter?.title
const pageSlug = canonicalizeServer(page.slug!)
const tags = page.frontmatter?.tags ?? []
@@ -48,7 +57,7 @@
{tags.map((tag) => (
<li>
<a
- class="internal"
+ class="internal tag-link"
href={resolveRelative(slug, `tags/${tag}` as CanonicalSlug)}
>
#{tag}
@@ -68,4 +77,8 @@
.section h3 {
margin: 0;
}
+
+.section > .tags {
+ margin: 0;
+}
`
--
Gitblit v1.10.0