-
-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recent posts is empty if all the current posts are marked as featured #204
Comments
I intentionally filtered Maybe the best way to deal with this problem is to hide To do so, for now, you can remove the filter logic in <section id="recent-posts">
<h2>Recent Posts</h2>
<ul>
{
sortedPosts
.filter(({ data }) => !data.featured) // 👈🏻 remove this
.map(
({ data, slug }, index) =>
index < 4 && (
<Card
href={`/posts/${slug}`}
frontmatter={data}
secHeading={false}
/>
)
)
}
</ul>
.... |
understood, I wonder if there needs to be some smarter logic to see if it is going to be empty then populate it as a message saying 'there are no posts' will be a bit odd. something like, if there are posts and there is something after the filter, show that, if there are sortedPosts but nothing after the filter, remove the filter, and if there are no sorted posts, show 'no posts yet' |
Changes made: - Removed the recent posts section if there are no posts under the recent section. - Eliminated unnecessary <Hr /> tags when there are no recent posts. - Extracted all-links from the recent section. Closes: #204
Made a PR for this issue. |
Changes made: - Removed the recent posts section if there's no post under the recent section. - Eliminated unnecessary <Hr /> tags when there's no recent post. - Extracted all-links from the recent section and put it above the footer. Closes: #204
On my version of this (Smale.Codes there is only one post and it is featured. As such there is nothing in Recent and nothing to say 'no posts here' or similar.
The text was updated successfully, but these errors were encountered: