From 7d1cd710a78a6db80c97b401c78981032c62d024 Mon Sep 17 00:00:00 2001 From: Brian Clark Date: Thu, 21 Oct 2021 17:04:43 -0500 Subject: [PATCH] add: rss feed support --- astro.config.mjs | 8 ++++++++ src/pages/blog/[...page].astro | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/astro.config.mjs b/astro.config.mjs index 17a41da..03bfc35 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -10,4 +10,12 @@ export default /** @type {import('astro').AstroUserConfig} */ ({ // Enable the Preact renderer to support Preact JSX components. renderers: ['@astrojs/renderer-svelte'], + buildOptions: { + /** Your public domain, e.g.: https://my-site.dev/. Used to generate sitemaps and canonical URLs. */ + site: 'https://clarkio.com', + /** Generate an automatically-generated sitemap for your build. + * Default: true + */ + sitemap: true, + }, }); diff --git a/src/pages/blog/[...page].astro b/src/pages/blog/[...page].astro index 0fe0068..393843e 100644 --- a/src/pages/blog/[...page].astro +++ b/src/pages/blog/[...page].astro @@ -13,17 +13,17 @@ export async function getStaticPaths({paginate, rss}) { // Generate an RSS feed from this collection of posts. // NOTE: This is disabled by default, since it requires `buildOptions.site` to be set in your "astro.config.mjs" file. - // rss({ - // title: 'Don’s Blog', - // description: 'An example blog on Astro', - // customData: `en-us`, - // items: sortedPosts.map(item => ({ - // title: item.title, - // description: item.description, - // link: item.url, - // pubDate: item.date, - // })), - // }); + rss({ + title: 'Clarkio | Blog', + description: 'Writings by clarkio.', + customData: `en-us`, + items: sortedPosts.map(item => ({ + title: item.title, + description: item.description, + link: item.url, + pubDate: item.date, + })), + }); // Return a paginated collection of paths for all posts return paginate(sortedPosts, {pageSize: 5});