github withastro/astro @astrojs/rss@2.1.0

latest releases: astro@4.15.11, @astrojs/sitemap@3.2.0, astro@5.0.0-beta.3...
20 months ago

Minor Changes

  • #5851 81dce94f2 Thanks @bholmesdev! - Update RSS config for readability and consistency with Astro 2.0.

    • 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.

      If you rely on our import.meta.glob() handling, we suggest adding the pagesGlobToRssItems() wrapper to your RSS config:

      // src/pages/rss.xml.js
      import rss, {
      +  pagesGlobToRssItems
      } from '@astrojs/rss';
      
      export function get(context) {
        return rss({
      +    items: pagesGlobToRssItems(
            import.meta.glob('./blog/*.{md,mdx}'),
      +    ),
        });
      }
    • 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:

      import { defineCollection } from 'astro:content';
      import { rssSchema } from '@astrojs/rss';
      
      const blog = defineCollection({
        schema: rssSchema,
      });
      
      export const collections = { blog };

Don't miss a new astro release

NewReleases is sending notifications on new releases.