diff --git a/src/components/Tags.astro b/src/components/Tags.astro
index 5a7d080..97aee7f 100644
--- a/src/components/Tags.astro
+++ b/src/components/Tags.astro
@@ -5,7 +5,7 @@ const { tags } = Astro.props
{
tags.sort().map((tag: string) => (
-
+
{tag}
))
diff --git a/src/pages/archive/[tag].astro b/src/pages/archive/[tag].astro
index 4912a4c..03bdcb9 100644
--- a/src/pages/archive/[tag].astro
+++ b/src/pages/archive/[tag].astro
@@ -6,6 +6,10 @@ import FormattedDate from '@components/FormattedDate.astro'
const { tag } = Astro.params
+const page = Number.parseInt(Astro.url.searchParams.get('page'))
+const prevPage = page - 1
+const nextPage = page + 1
+
const posts = await getCollection('blog', ({ data }) => {
if (tag === 'all') {
return true
@@ -18,15 +22,69 @@ if (posts.length === 0) {
}
posts.sort((a, b) => Date.parse(b.data.pubDate) - Date.parse(a.data.pubDate))
+const totalPosts = posts.length
+
+const start = (page - 1) * 10
+const end = page * 10
+
+const displayPosts = posts.slice(start, end)
---
{
- posts.map(({ slug, data }) => (
-
-
{data.title} -{' '}
+ displayPosts.map(({ slug, data }) => (
+
))
}
+
+
+
+ {
+ end >= totalPosts ? null : (
+
+ Next →
+
+ )
+ }
+
+
+
+
diff --git a/src/pages/index.astro b/src/pages/index.astro
index edaf8f9..48fff0d 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -18,7 +18,7 @@ const posts = await getCollection('blog')
{
posts.length < 5 ? null : (