at.ncvp.me

First Astro project with 'pages' and 'posts' collections

Adding 'Select posts'

Follow what's done in astro-blog

Posted on 18th May 2026 at 15:40 by NickP


Implementation

  1. copy src/pages/select-posts.astro from astro-blog. Make one change of ‘blog’ to ‘posts’ for the collection and four of ‘blog’ to ‘post’ in url slug sections.

  2. npm install fuse.js

  3. Change path in get_post_lines() in src/utils/post_helpers.js to make links like /posts/author/xxxx rather than /blog/author/xxxx. Similarly for /category/, /tag and /yyyy/mm.

  4. Add src/pages/posts/author/[author].astro, src/pages/posts/category/[category].astro, src/pages/posts/tag/[tag].astro and src/pages/posts/[year]/[month].astro

  5. Add menu item

Category: dev Tags: coding post

Rendered by src/pages/posts/[slug].astro