Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #49 from palladians/fix/blog-show-only-published-a…
Browse files Browse the repository at this point in the history
…rticles

Fix/blog show only published articles
  • Loading branch information
mrcnk authored Sep 26, 2023
2 parents 08bee5a + 7109ebc commit d0f1969
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="max-w-[72rem] mx-auto flex flex-1 flex-col gap-8">
Expand Down
2 changes: 1 addition & 1 deletion src/app/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
)) 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(),
Expand Down

0 comments on commit d0f1969

Please sign in to comment.