Skip to content

Commit 5f10009

Browse files
committed
Wrapped the blog index in the base layout
1 parent a2be212 commit 5f10009

1 file changed

Lines changed: 19 additions & 21 deletions

File tree

src/pages/blog/[...page].astro

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import { getCollection, type CollectionEntry } from "astro:content";
33
import type { GetStaticPaths, Page } from "astro";
4+
import BaseLayout from "@/layouts/BaseLayout.astro";
45
56
export const getStaticPaths: GetStaticPaths = async ({ paginate }) => {
67
const posts = await getCollection("blog", ({ data }) => data.draft !== true);
@@ -11,26 +12,23 @@ type BlogPage = Page<CollectionEntry<"blog">>;
1112
const { page } = Astro.props as { page: BlogPage };
1213
---
1314

14-
<html lang="en">
15-
<head><title>Blog — Page {page.currentPage}</title></head>
16-
<body>
17-
<h1>Blog</h1>
15+
<BaseLayout title="Blog">
16+
<h1>Blog</h1>
1817

19-
<ul>
20-
{
21-
page.data.map((p) => (
22-
<li>
23-
<a href={`/blog/${p.id}/`}>{p.data.title}</a>
24-
<small> - {p.data.pubDate.toDateString()}</small>
25-
</li>
26-
))
27-
}
28-
</ul>
18+
<ul>
19+
{
20+
page.data.map((p) => (
21+
<li>
22+
<a href={`/blog/${p.id}/`}>{p.data.title}</a>
23+
<small> - {p.data.pubDate.toDateString()}</small>
24+
</li>
25+
))
26+
}
27+
</ul>
2928

30-
<nav aria-label="Pagination">
31-
{page.url.prev && <a href={page.url.prev}>← Newer</a>}
32-
<span> Page {page.currentPage} / {page.lastPage} </span>
33-
{page.url.next && <a href={page.url.next}>Older →</a>}
34-
</nav>
35-
</body>
36-
</html>
29+
<nav aria-label="Pagination">
30+
{page.url.prev && <a href={page.url.prev}>← Newer</a>}
31+
<span> Page {page.currentPage} / {page.lastPage} </span>
32+
{page.url.next && <a href={page.url.next}>Older →</a>}
33+
</nav>
34+
</BaseLayout>

0 commit comments

Comments
 (0)