mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
fix: sort rss feed from latest to oldest (#38)
* Sorted the rss feed from latest to oldest. Which is crucial for RSS readers. * sorted rss using util func * refactor: remove redundant draft filter and update import positions --------- Co-authored-by: Saif71 <> Co-authored-by: Sat Naing <satnaingdev@gmail.com>
This commit is contained in:
committed by
GitHub
parent
69b39fecdf
commit
9e62b637e8
@@ -1,15 +1,18 @@
|
||||
import rss from "@astrojs/rss";
|
||||
import { getCollection } from "astro:content";
|
||||
import { SITE } from "@config";
|
||||
import getSortedPosts from "@utils/getSortedPosts";
|
||||
import slugify from "@utils/slugify";
|
||||
import { SITE } from "@config";
|
||||
|
||||
export async function get() {
|
||||
const posts = await getCollection("blog", ({ data }) => !data.draft);
|
||||
const posts = await getCollection("blog");
|
||||
const sortedPosts = getSortedPosts(posts);
|
||||
return rss({
|
||||
title: SITE.title,
|
||||
description: SITE.desc,
|
||||
site: SITE.website,
|
||||
items: posts.map(({ data }) => ({
|
||||
items: sortedPosts
|
||||
.map(({ data }) => ({
|
||||
link: `posts/${slugify(data)}`,
|
||||
title: data.title,
|
||||
description: data.description,
|
||||
|
||||
Reference in New Issue
Block a user