Ensure "no posts" message doesn't get placed in ul

This commit is contained in:
Maciej Pędzich 2023-05-13 08:40:23 +02:00
parent 6a35c00298
commit d5a7b418a3

View File

@ -16,16 +16,22 @@ const posts = (
).sort((a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf());
---
<ul class="post-list">
{
{
posts.length === 0 ? (
<p>No posts were found</p>
<p id="no-posts-found">No posts were found...</p>
) : (
posts.map((post) => (
<ul class="post-list">
{posts.map((post) => (
<li>
<a href={`/blog/${post.slug}`}>{post.data.title}</a>
</li>
))
))}
</ul>
)
}
<style>
#no-posts-found {
text-align: center;
}
</ul>
</style>