jackyzha0 / quartz

🌱 a fast, batteries-included static-site generator that transforms Markdown content into fully functional websites
https://quartz.jzhao.xyz
MIT License
5.93k stars 2.37k forks source link

RecentNotes don't show notes from `content` folder #1226

Closed maibuith closed 2 weeks ago

maibuith commented 2 weeks ago

I'm trying to use Component.RecentNotes to display some notes directly from the content folder instead of another subfolder within content. My intention is to make the post links appear as abc.com/post-name instead of abc.com/posts/post-name. But the notes from content don't show up, only the title shows. Does anyone know why this happens and how to solve this?

Here's the code I put in quartz.layout.ts:

Component.RecentNotes({
        title: "Recent Posts",
        limit: 3,
        filter: (f) =>
          f.slug!.startsWith("content/") && f.slug! !== "content/index" && !f.frontmatter?.noindex,
        linkToMore: "content/" as SimpleSlug,
      }),

And only the title shows:

image

jackyzha0 commented 2 weeks ago

Try without content as a prefix, all slugs are relative to the root of the content folder so content/abc/def.md has a slug of abc/def