From 598c8e123e8995de5fbcf90118421d3a2e4382dd Mon Sep 17 00:00:00 2001 From: brklntmhwk_w Date: Tue, 2 Apr 2024 14:14:40 +0900 Subject: [PATCH] Generalized Pager more so it can be used in taxonomy contexts too --- .npmrc | 1 - src/components/BaseHead.astro | 3 +- src/components/BlogList.astro | 105 ++++++++++++++++++ src/components/Footer.astro | 2 +- src/components/Navigation.astro | 9 +- src/components/Pager.astro | 94 +++++++++------- src/content/blog/aaa.md | 6 +- src/content/blog/bbb.md | 6 +- src/content/blog/ccc.md | 6 +- src/content/blog/ddd.md | 6 +- src/content/blog/eee.md | 6 +- src/content/blog/fff.md | 6 +- src/content/blog/first-post.md | 2 +- src/content/blog/ggg.md | 6 +- src/content/blog/hhh.md | 4 +- src/content/blog/iii.md | 8 +- src/content/blog/markdown-style-guide.md | 2 +- src/content/blog/second-post.md | 2 +- src/content/blog/third-post.md | 6 +- src/content/blog/using-mdx.mdx | 2 +- src/content/config.ts | 8 ++ src/content/meta/site-data.yml | 6 + src/layouts/AboutLayout.astro | 6 +- src/layouts/BaseLayout.astro | 34 ++++++ src/layouts/BlogLayout.astro | 77 ++++++++++--- src/pages/blog/[...page].astro | 84 ++------------ .../categories/[category]/[...page].astro | 51 +++++++++ src/pages/blog/categories/index.astro | 36 ++++++ src/pages/blog/tags/[tag]/[...page].astro | 49 ++++++++ src/pages/blog/tags/index.astro | 36 ++++++ src/styles/global.css | 41 ++----- 31 files changed, 496 insertions(+), 214 deletions(-) delete mode 100644 .npmrc create mode 100644 src/components/BlogList.astro create mode 100644 src/pages/blog/categories/[category]/[...page].astro create mode 100644 src/pages/blog/categories/index.astro create mode 100644 src/pages/blog/tags/[tag]/[...page].astro create mode 100644 src/pages/blog/tags/index.astro diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 6c59086d..00000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -enable-pre-post-scripts=true diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index fe833704..20542a1e 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -18,6 +18,7 @@ const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props + @@ -40,7 +41,7 @@ const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props -{title} +{title} diff --git a/src/components/BlogList.astro b/src/components/BlogList.astro new file mode 100644 index 00000000..fa5d71d3 --- /dev/null +++ b/src/components/BlogList.astro @@ -0,0 +1,105 @@ +--- +import type { CollectionEntry } from 'astro:content' +import FormattedDate from '@/components/FormattedDate.astro' +import Svg from '@/components/Svg/index.astro' + +type Props = { + entries: CollectionEntry<'blog'>[] + kind: 'blog' | 'taxonomy' +} + +const { entries, kind } = Astro.props +--- + +{ + entries.length !== 0 ? ( + + ) : ( +

Woops! No entry found..

+ ) +} + diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 524dd3b7..82491671 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -2,7 +2,7 @@ const today = new Date() --- -