Skip to content

Draft frontmatter flag not respected in collection #6400

@gotofritz

Description

@gotofritz

What version of astro are you using?

2.0.2

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

pnpm

What operating system are you using?

Mac

Describe the Bug

draft: true in frontmatter of pages is respected, but in frontmatter of collections it isn't when generating static site.

As a workaround one can create a filter when calling getCollection and also getStaticPath

await getCollection("post", ({ data }) => import.meta.env.DEV || !data?.draft))

But that's not consistent with pages (where ItJustWorks) or with user expectations

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-tlp8uq

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P2: has workaroundAn edge case that only affects very specific usage, but has a trivial workaround (priority)feat: content collectionsRelated to the Content Collections feature (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions