summaryrefslogtreecommitdiff
path: root/src/pages/blog/micro
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/blog/micro')
-rw-r--r--src/pages/blog/micro/[page].astro32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/pages/blog/micro/[page].astro b/src/pages/blog/micro/[page].astro
new file mode 100644
index 0000000..9fb04f1
--- /dev/null
+++ b/src/pages/blog/micro/[page].astro
@@ -0,0 +1,32 @@
+---
+import MicroBlog from "@components/templates/MicroBlog.astro";
+import Base from "@layouts/Base.astro";
+import { fromPosts, isMicro } from "@lib/collection/helpers";
+import { identity } from "@utils/anonymous";
+import type {
+ GetStaticPaths,
+ InferGetStaticParamsType,
+ InferGetStaticPropsType,
+} from "astro";
+
+export const getStaticPaths = (async ({ paginate }) => {
+ const micros = await fromPosts(isMicro, identity);
+
+ return paginate(micros, { pageSize: 20 });
+}) satisfies GetStaticPaths;
+
+export type Params = InferGetStaticParamsType<typeof getStaticPaths>;
+export type Props = InferGetStaticPropsType<typeof getStaticPaths>;
+
+const { page } = Astro.props;
+---
+<Base title="Micro Blogue">
+ <h1>Page {page.currentPage}</h1>
+ <ul>
+ {page.data.map((micro) => <li><MicroBlog {...micro} /></li>)}
+ </ul>
+ {page.url.first ? <a href={page.url.first}>First</a> : null}
+ {page.url.prev ? <a href={page.url.prev}>Previous</a> : null}
+ {page.url.next ? <a href={page.url.next}>Next</a> : null}
+ {page.url.last ? <a href={page.url.last}>Last</a> : null}
+</Base>