Skip to content

Commit 91ff4eb

Browse files
committed
chore: bump version to 3.3.3 and update blog post filtering logic -[Bug]: Sitemap includes draft articles
Fixes #97
1 parent ccd5655 commit 91ff4eb

3 files changed

Lines changed: 7 additions & 25 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "frosti",
33
"type": "module",
4-
"version": "3.3.2",
4+
"version": "3.3.3",
55
"scripts": {
66
"dev": "astro dev",
77
"start": "astro dev",

src/pages/blog/[...slug].astro

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ import MainCard from "@/components/MainCard.astro";
1010
1111
export async function getStaticPaths() {
1212
const posts = await getCollection("blog");
13-
return posts.map((blog: { slug: any }) => ({
13+
14+
const filteredPosts = import.meta.env.PROD
15+
? posts.filter((post) => !post.data.draft)
16+
: posts;
17+
18+
return filteredPosts.map((blog) => ({
1419
params: { slug: blog.slug },
1520
props: { blog },
1621
}));
1722
}
18-
interface Props {
19-
blog: CollectionEntry<"blog">;
20-
}
2123
2224
const { blog } = Astro.props;
2325
const { Content, remarkPluginFrontmatter, headings } = await blog.render();

src/pages/sitemap.xml.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)