Skip to content

Commit

Permalink
Fix showing drafts in dev in About page πŸ“.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarty committed Apr 7, 2024
1 parent ca47297 commit e584ea8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/layouts/AuthorLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { type CollectionEntry, getCollection } from 'astro:content'
import SocialIcon from '@/components/social-icons/index.astro'
import RootLayout from './RootLayout.astro'
import Link from '../components/Link.astro'
import { sortBlogPosts } from '@/functions'
import { sortBlogPosts, excludeDrafts } from '@/functions'
import { ITEMS_PER_PAGE } from '@/consts'
import { useTranslations } from '@/i18n'
Expand All @@ -30,12 +30,12 @@ const {
} = Astro.props.content
// Get the author's posts
const authorPosts = await getCollection(
'blog',
({ data: { authors, draft } }) => {
return !draft && authors.some((author) => author.slug === Astro.props.slug)
}
)
const authorPosts = await getCollection('blog', (entry) => {
return (
excludeDrafts(entry) &&
entry.data.authors.some((author) => author.slug === Astro.props.slug)
)
})
.then(sortBlogPosts)
.then((posts) => {
return posts.slice(0, ITEMS_PER_PAGE).map((post) => {
Expand Down

0 comments on commit e584ea8

Please sign in to comment.