diff --git a/src/runtime/server/storage.ts b/src/runtime/server/storage.ts index 117d04b3d..3a5c37664 100644 --- a/src/runtime/server/storage.ts +++ b/src/runtime/server/storage.ts @@ -286,6 +286,13 @@ export function serverQueryContent (event: H3Event, query?: s params.sort = [{ _file: 1, $numeric: true }] } + if (!import.meta.dev) { + params.where = params.where || [] + if (!params.where.find(item => typeof item._draft !== 'undefined')) { + params.where.push({ _draft: { $ne: true } }) + } + } + // Filter by locale if: // - locales are defined // - query doesn't already have a locale filter