Jacky Zhao
2023-08-17 2f6747b1666316e579c6e7238092ac6a65d00925
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 ?? []