at.ncvp.me

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

Manage pages/posts frontmatter/metadata

I'm looking for a good way to do this across all pages and posts in the two collections

Posted on 1st Jun 2026 at 12:00 by Admin


VScode extension

Instead of having physical files deeply nested in /src/pages/xxxx/yyyy/, you would move your Markdown or MDX files into a new collection, for example, /src/content/docs

Define the collection schema in src/content/config.ts.

Create a catch-all dynamic route file at src/pages/[…slug].astro.

In this file, you query the collection using getCollection(), map the slugs, and render the pages.

Batch Node.js script

Follow Gemini’s suggestions

% npm install gray-matter

Conclusion

Use VScode + fmatter.py

Category: misc Tags:

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