diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index 11982da..d51c281 100755 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -60,6 +60,9 @@ const { title, meta_title, description, image, noindex, canonical } = /> + @@ -18,5 +14,11 @@ import {markdownify} from "@/lib/utils/textConverter"; En savoir plus

+ +

+ + + +

diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts new file mode 100644 index 0000000..3e14659 --- /dev/null +++ b/src/pages/rss.xml.ts @@ -0,0 +1,22 @@ +import rss from '@astrojs/rss'; +import config from '@/config/config.json'; +import {getCollection} from 'astro:content'; +import {sortByDate} from "../lib/utils/sortFunctions"; + +// noinspection JSUnusedGlobalSymbols +export async function GET(context: { site: any; }) { + const posts = await getCollection('posts'); + const sortedPosts = sortByDate(posts); + return rss({ + title: config.site.title, + description: config.metadata.meta_description, + site: context.site, + items: sortedPosts.map((post) => ({ + title: post.data.title, + pubDate: post.data.date, + description: post.data.description, + link: `/posts/${post.slug}`, + })), + customData: `fr-fr`, + }); +}