#RSS with TS and Zod

2 messages · Page 1 of 1 (latest)

amber atlas
#

I'm trying to implement an RSS feed, and I'm following along in the docs here
https://docs.astro.build/en/guides/rss/#setting-up-astrojsrss
I'm getting tripped up with;

You can configure your collection schema to enforce these expected RSS properties
and the example is

import { rssSchema } from '@astrojs/rss';

const blog = defineCollection({
  schema: rssSchema,
});

Currently, my astro config has

const artistCollection = defineCollection({
    schema: z.object({
        draft: z.boolean(),
        name: z.string(),
        ...
    }),
});

and if I change that to

const artistCollection = defineCollection({
  schema: rssSchema,
});

Then I no longer have those z.type definitions. Should I be changing rss.xml.js to rss.xml.ts and including types in there? Just not sure if that xml can be a .ts file or needs to remain js

Astro Documentation

Let users subscribe to your content by adding an RSS feed to your Astro site.

amber atlas
#

solved, yep, the rss.xml can be a ts file