feat: slug-a automatikoki ezartzen du
This commit is contained in:
1 parent
316ba0e84a
commit
47d593e09d
26 files changed
+36
-60
No files matched your search
@@ -7,7 +7,7 @@ export async function getStaticPaths() {
|
||||
|
||||
return posts.map((post) => {
|
||||
return {
|
||||
params: { slug: post.data.slug },
|
||||
params: { slug: post.id },
|
||||
props: { post },
|
||||
};
|
||||
});
|
||||
|
||||
+20
-20
@@ -5,26 +5,26 @@ import { SITE_TITLE, SITE_DESCRIPTION } from "../config";
|
||||
let posts = await getCollection("posts");
|
||||
|
||||
posts = posts.sort(
|
||||
(a, b) =>
|
||||
new Date(b.data.updated || b.data.added).valueOf() -
|
||||
new Date(a.data.updated || a.data.added).valueOf()
|
||||
(a, b) =>
|
||||
new Date(b.data.updated || b.data.added).valueOf() -
|
||||
new Date(a.data.updated || a.data.added).valueOf(),
|
||||
);
|
||||
|
||||
export const GET = () =>
|
||||
rss({
|
||||
title: SITE_TITLE || "",
|
||||
description: SITE_DESCRIPTION || "",
|
||||
site: import.meta.env.SITE,
|
||||
items: posts.map((post) => {
|
||||
return {
|
||||
link: `/post/${post.data.slug}`,
|
||||
title: post.data.title,
|
||||
pubDate: post.data.added,
|
||||
description: post.data.description,
|
||||
content: post.rendered.html,
|
||||
customData: `<updated>${
|
||||
post.data.updated ? post.data.updated : ""
|
||||
}</updated>`,
|
||||
};
|
||||
}),
|
||||
});
|
||||
rss({
|
||||
title: SITE_TITLE || "",
|
||||
description: SITE_DESCRIPTION || "",
|
||||
site: import.meta.env.SITE,
|
||||
items: posts.map((post) => {
|
||||
return {
|
||||
link: `/post/${post.id}`,
|
||||
title: post.data.title,
|
||||
pubDate: post.data.added,
|
||||
description: post.data.description,
|
||||
content: post.rendered.html,
|
||||
customData: `<updated>${
|
||||
post.data.updated ? post.data.updated : ""
|
||||
}</updated>`,
|
||||
};
|
||||
}),
|
||||
});
|
||||
Reference in new issue
Block a user