From 598e231f4aead2e62ffde89829604ad7d5d8811b Mon Sep 17 00:00:00 2001 From: Sat Naing Date: Tue, 20 Sep 2022 20:56:58 +0630 Subject: [PATCH] Update post/index page to display page 1 --- src/pages/posts/index.astro | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/pages/posts/index.astro b/src/pages/posts/index.astro index 1ec65c3..3be9591 100644 --- a/src/pages/posts/index.astro +++ b/src/pages/posts/index.astro @@ -1,29 +1,19 @@ --- -import Layout from "@layouts/Layout.astro"; -import Header from "@components/Header.astro"; -import Footer from "@components/Footer.astro"; -import Main from "@layouts/Main.astro"; -import Card from "@components/Card"; +import Posts from "@layouts/Posts.astro"; import getSortedPosts from "@utils/getSortedPosts"; +import getPageNumbers from "@utils/getPageNumbers"; import type { Frontmatter } from "@utils/types"; const posts = await Astro.glob("../../contents/*.md"); const sortedPosts = getSortedPosts(posts); + +const totalPages = getPageNumbers(posts.length); + +const paginatedPosts = sortedPosts.slice( + 0, + import.meta.env.PUBLIC_POST_PER_PAGE +); --- - -
-
-
    - { - sortedPosts.map(({ frontmatter }) => { - return ( - - ); - }) - } -
-
-