Editing content · Sections, pages & folders

Letting editors create folders

Check your routes before you turn this on. A page’s folder becomes part of its ID — seasonal/autumn-menu, not autumn-menu — and so part of its URL. Code that expects a single-level ID breaks on the first page an editor puts in a new folder: a [slug].astro route can’t take an ID containing /, so the whole site build fails (Missing parameter: slug) and nothing deploys — not just that page. Orbit can’t see your routes, so it can’t check this for you.

Your site is ready when every place that turns an entry into a page or a link copes with a / in the ID. The checks below are for Astro; on another generator, check the same things in the template that builds the pages (for Gatsby, the createPages code in gatsby-node.js) and in any list of posts.

  1. The page route is a rest route — [...slug].astro, not [slug].astro — and passes the whole ID through:

    ---
    // src/pages/blog/[...slug].astro
    import { getCollection, render } from "astro:content";
    
    export async function getStaticPaths() {
      const posts = await getCollection("blog");
      // p.id keeps the folders: "seasonal/autumn-menu" → /blog/seasonal/autumn-menu
      return posts.map((p) => ({ params: { slug: p.id }, props: { post: p } }));
    }
    
    const { post } = Astro.props;
    const { Content } = await render(post);
    ---
    <h1>{post.data.title}</h1>
    <Content />
  2. Links use the ID as-is — href={`/blog/${post.id}/`} — rather than rebuilding it from the file name or splitting it on /.

  3. Nothing lists a fixed set of folders. A listing page that filters by folder name (p.id.startsWith("2026/")), or a route per folder (src/pages/blog/2026/[slug].astro), won’t pick up a folder an editor makes. List from the whole collection, or group by p.id.split("/")[0].

  4. The glob reaches the depth — **/*.md, not *.md, in the content config or the content map’s files (Orbit already refuses a folder the glob can’t read).

Then switch it on for that section only, in Settings ▸ Collections (Add folders) or in orbit.config.yaml:

collections:
  blog:
    newFolders: true

Try it before handing it over: add a page in a new folder, push it to your testing branch, and check the preview build passes and the page opens. If your site uses folders for something with meaning — locales, categories with their own pages — leave it off and create those folders yourself.