Skip to content

Commit

Permalink
Fix issue with Astro missing the first post
Browse files Browse the repository at this point in the history
  • Loading branch information
kossnocorp committed Dec 17, 2023
1 parent e9b9bed commit 8e7bd6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Author from "../components/Author.astro";
const posts = (await getCollection("blog")).sort(
(a, b) => +b.data.pubDate - +a.data.pubDate
);
const first = posts.shift();
const first = posts[0];
if (!first) throw new Error("No posts found");
---

Expand All @@ -37,7 +37,7 @@ if (!first) throw new Error("No posts found");
</li>

{
posts.map((post) => (
posts.slice(1).map((post) => (
<li class="w-full max-w-screen-sm border-b border-monsoon-100 pb-8 sm:pb-10 last:border-none last:pb-0 dark:border-monsoon-950">
<a href={`/${post.slug.slice(11)}/`} class="space-y-2">
<h3 class="text-2xl sm:text-3xl font-bold leading-tight text-monsoon-950 dark:text-monsoon-300">
Expand Down

0 comments on commit 8e7bd6d

Please sign in to comment.