Format astro-rss
This commit is contained in:
parent
42edcdeeef
commit
05cf311128
1 changed files with 57 additions and 52 deletions
|
@ -6,83 +6,88 @@
|
||||||
|
|
||||||
- [#5851](https://github.com/withastro/astro/pull/5851) [`81dce94f2`](https://github.com/withastro/astro/commit/81dce94f2a6db598bd9e47fc2a4b9d713e58f286) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Update RSS config for readability and consistency with Astro 2.0.
|
- [#5851](https://github.com/withastro/astro/pull/5851) [`81dce94f2`](https://github.com/withastro/astro/commit/81dce94f2a6db598bd9e47fc2a4b9d713e58f286) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Update RSS config for readability and consistency with Astro 2.0.
|
||||||
|
|
||||||
#### Migration - `import.meta.glob()` handling
|
- **Migration - `import.meta.glob()` handling**
|
||||||
|
|
||||||
We have deprecated `items: import.meta.glob(...)` handling in favor of a separate `pagesGlobToRssItems()` helper. This simplifies our `items` configuration option to accept a single type, without losing existing functionality.
|
We have deprecated `items: import.meta.glob(...)` handling in favor of a separate `pagesGlobToRssItems()` helper. This simplifies our `items` configuration option to accept a single type, without losing existing functionality.
|
||||||
|
|
||||||
If you rely on our `import.meta.glob()` handling, we suggest adding the `pagesGlobToRssItems()` wrapper to your RSS config:
|
If you rely on our `import.meta.glob()` handling, we suggest adding the `pagesGlobToRssItems()` wrapper to your RSS config:
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
// src/pages/rss.xml.js
|
// src/pages/rss.xml.js
|
||||||
import rss, {
|
import rss, {
|
||||||
+ pagesGlobToRssItems
|
+ pagesGlobToRssItems
|
||||||
} from '@astrojs/rss';
|
} from '@astrojs/rss';
|
||||||
|
|
||||||
export function get(context) {
|
export function get(context) {
|
||||||
return rss({
|
return rss({
|
||||||
+ items: pagesGlobToRssItems(
|
+ items: pagesGlobToRssItems(
|
||||||
import.meta.glob('./blog/*.{md,mdx}'),
|
import.meta.glob('./blog/*.{md,mdx}'),
|
||||||
+ ),
|
+ ),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### New `rssSchema` for content collections
|
- **New `rssSchema` for content collections**
|
||||||
|
|
||||||
`@astrojs/rss` now exposes an `rssSchema` for use with content collections. This ensures all RSS feed properties are present in your frontmatter:
|
`@astrojs/rss` now exposes an `rssSchema` for use with content collections. This ensures all RSS feed properties are present in your frontmatter:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { defineCollection } from 'astro:content';
|
import { defineCollection } from 'astro:content';
|
||||||
import { rssSchema } from '@astrojs/rss';
|
import { rssSchema } from '@astrojs/rss';
|
||||||
|
|
||||||
const blog = defineCollection({
|
const blog = defineCollection({
|
||||||
schema: rssSchema,
|
schema: rssSchema,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const collections = { blog };
|
export const collections = { blog };
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2.1.0-beta.0
|
## 2.1.0-beta.0
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>See changes in 2.1.0-beta.0</summary>
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|
||||||
- [#5851](https://github.com/withastro/astro/pull/5851) [`81dce94f2`](https://github.com/withastro/astro/commit/81dce94f2a6db598bd9e47fc2a4b9d713e58f286) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Update RSS config for readability and consistency with Astro 2.0.
|
- [#5851](https://github.com/withastro/astro/pull/5851) [`81dce94f2`](https://github.com/withastro/astro/commit/81dce94f2a6db598bd9e47fc2a4b9d713e58f286) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Update RSS config for readability and consistency with Astro 2.0.
|
||||||
|
|
||||||
#### Migration - `import.meta.glob()` handling
|
- **Migration - `import.meta.glob()` handling**
|
||||||
|
|
||||||
We have deprecated `items: import.meta.glob(...)` handling in favor of a separate `pagesGlobToRssItems()` helper. This simplifies our `items` configuration option to accept a single type, without losing existing functionality.
|
We have deprecated `items: import.meta.glob(...)` handling in favor of a separate `pagesGlobToRssItems()` helper. This simplifies our `items` configuration option to accept a single type, without losing existing functionality.
|
||||||
|
|
||||||
If you rely on our `import.meta.glob()` handling, we suggest adding the `pagesGlobToRssItems()` wrapper to your RSS config:
|
If you rely on our `import.meta.glob()` handling, we suggest adding the `pagesGlobToRssItems()` wrapper to your RSS config:
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
// src/pages/rss.xml.js
|
// src/pages/rss.xml.js
|
||||||
import rss, {
|
import rss, {
|
||||||
+ pagesGlobToRssItems
|
+ pagesGlobToRssItems
|
||||||
} from '@astrojs/rss';
|
} from '@astrojs/rss';
|
||||||
|
|
||||||
export function get(context) {
|
export function get(context) {
|
||||||
return rss({
|
return rss({
|
||||||
+ items: pagesGlobToRssItems(
|
+ items: pagesGlobToRssItems(
|
||||||
import.meta.glob('./blog/*.{md,mdx}'),
|
import.meta.glob('./blog/*.{md,mdx}'),
|
||||||
+ ),
|
+ ),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### New `rssSchema` for content collections
|
- **New `rssSchema` for content collections**
|
||||||
|
|
||||||
`@astrojs/rss` now exposes an `rssSchema` for use with content collections. This ensures all RSS feed properties are present in your frontmatter:
|
`@astrojs/rss` now exposes an `rssSchema` for use with content collections. This ensures all RSS feed properties are present in your frontmatter:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { defineCollection } from 'astro:content';
|
import { defineCollection } from 'astro:content';
|
||||||
import { rssSchema } from '@astrojs/rss';
|
import { rssSchema } from '@astrojs/rss';
|
||||||
|
|
||||||
const blog = defineCollection({
|
const blog = defineCollection({
|
||||||
schema: rssSchema,
|
schema: rssSchema,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const collections = { blog };
|
export const collections = { blog };
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## 2.0.0
|
## 2.0.0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue