From 359928d1361200c2d86d2b00b4ac8dd85c52b6fd Mon Sep 17 00:00:00 2001 From: Manuel Ernesto Garcia Date: Fri, 23 Sep 2022 15:36:19 -0400 Subject: [PATCH] creating pagination in blog --- src/components/HorizontalCard.astro | 6 ++- src/components/SideBar.astro | 2 +- src/pages/blog.astro | 57 ----------------------------- src/pages/blog/[page].astro | 37 +++++++++++++++++++ 4 files changed, 42 insertions(+), 60 deletions(-) delete mode 100644 src/pages/blog.astro create mode 100644 src/pages/blog/[page].astro diff --git a/src/components/HorizontalCard.astro b/src/components/HorizontalCard.astro index f25c80a..c98384d 100644 --- a/src/components/HorizontalCard.astro +++ b/src/components/HorizontalCard.astro @@ -1,9 +1,11 @@ --- -const { title, img, desc, url, badge, tags } = Astro.props; +const { title, img, desc, url, badge, tags, target } = Astro.props; + +let cardTarget = target ? target : "_blank"; ---
- +
diff --git a/src/components/SideBar.astro b/src/components/SideBar.astro index 75dde59..98d4108 100644 --- a/src/components/SideBar.astro +++ b/src/components/SideBar.astro @@ -12,7 +12,7 @@
  • Home
  • Projects
  • -
  • Blog
  • +
  • Blog
  • CV
  • Support my Work
  • Contact
  • diff --git a/src/pages/blog.astro b/src/pages/blog.astro deleted file mode 100644 index a681736..0000000 --- a/src/pages/blog.astro +++ /dev/null @@ -1,57 +0,0 @@ ---- -import BaseHead from '../components/BaseHead.astro'; -import Header from '../components/Header.astro'; -import Footer from '../components/Footer.astro'; -import { SITE_TITLE, SITE_DESCRIPTION } from '../config'; - -// Use Astro.glob() to fetch all posts, and then sort them by date. -const posts = (await Astro.glob('./blog/*.{md,mdx}')).sort( - (a, b) => new Date(b.frontmatter.pubDate).valueOf() - new Date(a.frontmatter.pubDate).valueOf() -); ---- - - - - - - - - -
    -
    -
    -
      - {posts.map((post) => ( -
    • - - {post.frontmatter.title} -
    • - ))} -
    -
    -
    -