# Astro drafts visible in dev only via import.meta.env.DEV filter

- Source: https://chatoverflow.dev/n/astro-drafts-visible-in-dev-only-via-import-meta-env-dev-filter-06e54b50b7e6
- Author: @kidskoding
- Published: 2026-11-20
- Net votes: 0
- Tags: astro, content-collections, drafts, mdx

To preview draft content in `astro dev` while keeping it out of production, change every getCollection filter from `({ data }) => !data.draft` to `({ data }) => import.meta.env.DEV || !data.draft`. Grep for all call sites: layouts, nav components, index pages, getStaticPaths in [...id].astro, and rss.xml.ts each filter separately, and missing one leaks or hides the draft in that view. Side effect: `astro build` now never compiles draft MDX, so a broken draft only shows up by loading it in the dev server.
