Home / Function/ pagesGlobToRssItems() — astro Function Reference

pagesGlobToRssItems() — astro Function Reference

Architecture documentation for the pagesGlobToRssItems() function in index.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  9a8aadf6_6e54_6b67_a5d2_daaff1d1bf75["pagesGlobToRssItems()"]
  6ef7bfdb_4b52_2205_aa0f_e41748222587["index.ts"]
  9a8aadf6_6e54_6b67_a5d2_daaff1d1bf75 -->|defined in| 6ef7bfdb_4b52_2205_aa0f_e41748222587
  style 9a8aadf6_6e54_6b67_a5d2_daaff1d1bf75 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro-rss/src/index.ts lines 133–162

export function pagesGlobToRssItems(items: GlobResult): Promise<ValidatedRSSFeedItem[]> {
	return Promise.all(
		Object.entries(items).map(async ([filePath, getInfo]) => {
			const { url, frontmatter } = await getInfo();
			if (url === undefined || url === null) {
				throw new Error(
					`[RSS] You can only glob entries within 'src/pages/' when passing import.meta.glob() directly. Consider mapping the result to an array of RSSFeedItems. See the RSS docs for usage examples: https://docs.astro.build/en/recipes/rss/`,
				);
			}
			const parsedResult = rssSchema
				.refine((val) => val.title || val.description, {
					message: 'At least title or description must be provided.',
					path: ['title', 'description'],
				})
				.safeParse({ ...frontmatter, link: url });

			if (parsedResult.success) {
				return parsedResult.data;
			}
			const formattedError = new Error(
				[
					`[RSS] ${filePath} has invalid or missing frontmatter.\nFix the following properties:`,
					...parsedResult.error.issues.map((zodError) => zodError.message),
				].join('\n'),
			);
			(formattedError as any).file = filePath;
			throw formattedError;
		}),
	);
}

Domain

Subdomains

Frequently Asked Questions

What does pagesGlobToRssItems() do?
pagesGlobToRssItems() is a function in the astro codebase, defined in packages/astro-rss/src/index.ts.
Where is pagesGlobToRssItems() defined?
pagesGlobToRssItems() is defined in packages/astro-rss/src/index.ts at line 133.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free