Home

Fix astro RSS error which says that file has invalid or missing frontmatter.

Probably you've encountered this error message because you are using @astrojs/rss package to create RSS feed for your website

[RSS] [File path] has invalid or missing frontmatter.
Fix the following properties:
Invalid input

Solution

Check if your markdown file has following properties in it's frontmatter

If you have a date property in your frontmatter, but with a different name instead of pubDate, then you need to parse it yourself.

import rss from '@astrojs/rss';

export async function get(context) {
  const postImportResult = import.meta.glob('../posts/**/*.md', { eager: true }); 
  const posts = Object.values(postImportResult);

  return rss({
    title: 'Buzz’s Blog',
    description: 'A humble Astronaut’s guide to the stars',
    site: context.site,
    items: blog.map((post) => ({
      link: post.url,
      pubDate: post.date
    })),
  });
}


Last Updated on

Next Post: GraphProtocol: TS2322 null assignment in Subgraph →

Comments