mirror of
https://github.com/tauri-apps/tauri-docs.git
synced 2026-01-31 00:35:16 +01:00
docs: update rss to use autogenerated from starlight-blog (#2165)
Co-authored-by: Simon Hyll <hyllsimon@gmail.com>
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
/ko/* /:splat 302
|
||||
/it/* /:splat 302
|
||||
|
||||
# blog rss
|
||||
/blog.xml /blog/rss.xml 301
|
||||
|
||||
# Docs rework
|
||||
|
||||
/guides /start 301
|
||||
|
||||
@@ -6,5 +6,5 @@ i18nReady: true
|
||||
import { LinkCard } from '@astrojs/starlight/components';
|
||||
|
||||
<LinkCard title="All updates" href="/feed.xml" />
|
||||
<LinkCard title="Blog updates" href="/blog.xml" />
|
||||
<LinkCard title="Blog updates" href="/blog/rss.xml" />
|
||||
<LinkCard title="Pages updates" href="/pages.xml" />
|
||||
@@ -1,33 +0,0 @@
|
||||
// This RSS includes only blog pages
|
||||
import rss from '@astrojs/rss';
|
||||
import { getCollection } from 'astro:content';
|
||||
import type { APIContext } from 'astro';
|
||||
|
||||
// https://docs.astro.build/en/reference/api-reference/#endpoint-context
|
||||
export async function GET(context: APIContext) {
|
||||
const posts = await getCollection('docs', ({ id }) => {
|
||||
return id.startsWith('blog');
|
||||
});
|
||||
|
||||
posts.sort((a, b) => {
|
||||
const dateA = a.data.date;
|
||||
const dateB = b.data.date;
|
||||
if (dateA && dateB) {
|
||||
if (dateA < dateB) return 1;
|
||||
if (dateA > dateB) return -1;
|
||||
return 0;
|
||||
} else return 0;
|
||||
});
|
||||
|
||||
return rss({
|
||||
title: 'Tauri Blog',
|
||||
description: 'The cross-platform app building toolkit',
|
||||
site: context.site as URL,
|
||||
items: posts.map((post) => ({
|
||||
pubDate: post.data.date,
|
||||
description: post.data.excerpt,
|
||||
...post.data,
|
||||
link: `/${post.slug}/`,
|
||||
})),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user