From 19ebddacd4478e686dab073aef3cb276bab20391 Mon Sep 17 00:00:00 2001 From: Tomek Marciniak Date: Tue, 26 Sep 2023 17:54:49 +0200 Subject: [PATCH 1/2] fix(blog): show only published articles --- src/app/blog/page.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/blog/page.tsx b/src/app/blog/page.tsx index 082238b..a102d50 100644 --- a/src/app/blog/page.tsx +++ b/src/app/blog/page.tsx @@ -19,7 +19,11 @@ const BlogPage = async () => { const t = await getT() const posts: ApiPost[] = await pocketbase .collection('blog_posts') - .getFullList({ expand: 'author', sort: '-publishedAt' }) + .getFullList({ + expand: 'author', + sort: '-publishedAt', + filter: 'published = true' + }) const [highlight, ...restOfPosts] = posts return (
From 7109ebc63828be7ab003348b5a48ca08fe9879d5 Mon Sep 17 00:00:00 2001 From: Tomek Marciniak Date: Tue, 26 Sep 2023 17:56:10 +0200 Subject: [PATCH 2/2] fix(blog): only published in sitemap --- src/app/sitemap.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts index 35f3023..15aaab4 100644 --- a/src/app/sitemap.ts +++ b/src/app/sitemap.ts @@ -64,7 +64,7 @@ export default async function sitemap(): Promise { )) as MetadataRoute.Sitemap[] const postsRaw: ApiPost[] = await pocketbase .collection('blog_posts') - .getFullList({ sort: '-publishedAt' }) + .getFullList({ sort: '-publishedAt', filter: 'published = true' }) const posts = postsRaw.map((post) => ({ url: `${APP_URL}/blog/${post.slug}`, lastModified: new Date(),