summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/silent-bikes-crash.md8
-rw-r--r--packages/astro-rss/README.md4
-rw-r--r--packages/astro-rss/src/index.ts10
-rw-r--r--packages/astro/src/@types/astro.ts9
-rw-r--r--packages/astro/src/core/build/generate.ts5
-rw-r--r--packages/astro/src/core/errors/errors-data.ts2
-rw-r--r--packages/astro/src/core/render/core.ts10
7 files changed, 41 insertions, 7 deletions
diff --git a/.changeset/silent-bikes-crash.md b/.changeset/silent-bikes-crash.md
new file mode 100644
index 000000000..66f066943
--- /dev/null
+++ b/.changeset/silent-bikes-crash.md
@@ -0,0 +1,8 @@
+---
+'@astrojs/rss': patch
+'astro': patch
+---
+
+Deprecate the `markdown.drafts` configuration option.
+
+If you'd like to create draft pages that are visible in dev but not in production, you can [migrate to content collections](https://docs.astro.build/en/guides/content-collections/#migrating-from-file-based-routing) and [manually filter out pages](https://docs.astro.build/en/guides/content-collections/#filtering-collection-queries) with the `draft: true` frontmatter property instead.
diff --git a/packages/astro-rss/README.md b/packages/astro-rss/README.md
index 47dfc1747..2a2fb7db2 100644
--- a/packages/astro-rss/README.md
+++ b/packages/astro-rss/README.md
@@ -65,8 +65,6 @@ export function get(context) {
site: context.site,
// list of `<item>`s in output xml
items: [...],
- // include draft posts in the feed (default: false)
- drafts: true,
// (optional) absolute path to XSL stylesheet in your project
stylesheet: '/rss-styles.xsl',
// (optional) inject custom xml
@@ -118,6 +116,8 @@ When providing a formatted RSS item list, see the [`RSSFeedItem` type reference]
Type: `boolean (optional)`
+**Deprecated**: Manually filter `items` instead.
+
Set `drafts: true` to include [draft posts](https://docs.astro.build/en/guides/markdown-content/#draft-pages) in the feed output. By default, this option is `false` and draft posts are not included.
### stylesheet
diff --git a/packages/astro-rss/src/index.ts b/packages/astro-rss/src/index.ts
index 4d97647f1..843edd146 100644
--- a/packages/astro-rss/src/index.ts
+++ b/packages/astro-rss/src/index.ts
@@ -27,7 +27,10 @@ export type RSSOptions = {
stylesheet?: z.infer<typeof rssOptionsValidator>['stylesheet'];
/** Specify custom data in opening of file */
customData?: z.infer<typeof rssOptionsValidator>['customData'];
- /** Whether to include drafts or not */
+ /**
+ * Whether to include drafts or not
+ * @deprecated Deprecated since version 3.0. Use content collections instead.
+ */
drafts?: z.infer<typeof rssOptionsValidator>['drafts'];
trailingSlash?: z.infer<typeof rssOptionsValidator>['trailingSlash'];
};
@@ -45,7 +48,10 @@ export type RSSFeedItem = {
description?: z.infer<typeof rssSchema>['description'];
/** Append some other XML-valid data to this item */
customData?: z.infer<typeof rssSchema>['customData'];
- /** Whether draft or not */
+ /**
+ * Whether draft or not
+ * @deprecated Deprecated since version 3.0. Use content collections instead.
+ */
draft?: z.infer<typeof rssSchema>['draft'];
/** Categories or tags related to the item */
categories?: z.infer<typeof rssSchema>['categories'];
diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts
index acb092f0a..557ad1ed1 100644
--- a/packages/astro/src/@types/astro.ts
+++ b/packages/astro/src/@types/astro.ts
@@ -856,7 +856,7 @@ export interface AstroUserConfig {
* @name build.split
* @type {boolean}
* @default `false`
- * @deprecated since version 3.0
+ * @deprecated Deprecated since version 3.0.
* @description
* The build config option `build.split` has been replaced by the adapter configuration option [`functionPerRoute`](/en/reference/adapter-reference/#functionperroute).
*
@@ -870,7 +870,7 @@ export interface AstroUserConfig {
* @name build.excludeMiddleware
* @type {boolean}
* @default `false`
- * @deprecated since version 3.0
+ * @deprecated Deprecated since version 3.0.
* @description
* The build config option `build.excludeMiddleware` has been replaced by the adapter configuration option [`edgeMiddleware`](/en/reference/adapter-reference/#edgemiddleware).
*
@@ -1064,6 +1064,7 @@ export interface AstroUserConfig {
* @name markdown.drafts
* @type {boolean}
* @default `false`
+ * @deprecated Deprecated since version 3.0. Use content collections instead.
* @description
* Control whether Markdown draft pages should be included in the build.
*
@@ -1510,6 +1511,10 @@ export interface ComponentInstance {
default: AstroComponentFactory;
css?: string[];
prerender?: boolean;
+ /**
+ * Only used for logging if deprecated drafts feature is used
+ */
+ frontmatter?: Record<string, any>;
getStaticPaths?: (options: GetStaticPathsOptions) => GetStaticPathsResult;
}
diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts
index 646bb1d42..5ec60b86d 100644
--- a/packages/astro/src/core/build/generate.ts
+++ b/packages/astro/src/core/build/generate.ts
@@ -261,6 +261,11 @@ async function generatePage(
const pageModule = await pageModulePromise();
if (shouldSkipDraft(pageModule, pipeline.getSettings())) {
logger.info(null, `${magenta('⚠️')} Skipping draft ${pageData.route.component}`);
+ // TODO: Remove in Astro 4.0
+ logger.warn(
+ 'astro',
+ `The drafts feature is deprecated. You should migrate to content collections instead. See https://docs.astro.build/en/guides/content-collections/#filtering-collection-queries for more information.`
+ );
return;
}
diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts
index cc88d80f2..60e78adf6 100644
--- a/packages/astro/src/core/errors/errors-data.ts
+++ b/packages/astro/src/core/errors/errors-data.ts
@@ -42,7 +42,7 @@ export const UnknownCompilerError = {
* The `Astro.redirect` function is only available when [Server-side rendering](/en/guides/server-side-rendering/) is enabled.
*
* To redirect on a static website, the [meta refresh attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta) can be used. Certain hosts also provide config-based redirects (ex: [Netlify redirects](https://docs.netlify.com/routing/redirects/)).
- * @deprecated since version 2.6
+ * @deprecated Deprecated since version 2.6.
*/
export const StaticRedirectNotAvailable = {
name: 'StaticRedirectNotAvailable',
diff --git a/packages/astro/src/core/render/core.ts b/packages/astro/src/core/render/core.ts
index 24c411e0b..fb10ccc80 100644
--- a/packages/astro/src/core/render/core.ts
+++ b/packages/astro/src/core/render/core.ts
@@ -8,6 +8,7 @@ import type {
import { renderPage as runtimeRenderPage } from '../../runtime/server/index.js';
import { attachCookiesToResponse } from '../cookies/index.js';
import { callEndpoint, createAPIContext } from '../endpoint/index.js';
+import { warn } from '../logger/core.js';
import { callMiddleware } from '../middleware/callMiddleware.js';
import { redirectRouteGenerate, redirectRouteStatus, routeIsRedirect } from '../redirects/index.js';
import type { RenderContext } from './context.js';
@@ -57,6 +58,15 @@ export async function renderPage({ mod, renderContext, env, cookies }: RenderPag
locals: renderContext.locals ?? {},
});
+ // TODO: Remove in Astro 4.0
+ if (mod.frontmatter && typeof mod.frontmatter === 'object' && 'draft' in mod.frontmatter) {
+ warn(
+ env.logging,
+ 'astro',
+ `The drafts feature is deprecated and used in ${renderContext.route.component}. You should migrate to content collections instead. See https://docs.astro.build/en/guides/content-collections/#filtering-collection-queries for more information.`
+ );
+ }
+
const response = await runtimeRenderPage(
result,
Component,