File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11---
22import { getCollection , type CollectionEntry } from " astro:content" ;
33import type { GetStaticPaths , Page } from " astro" ;
4+ import BaseLayout from " @/layouts/BaseLayout.astro" ;
45
56export const getStaticPaths: GetStaticPaths = async ({ paginate }) => {
67 const posts = await getCollection (" blog" , ({ data }) => data .draft !== true );
@@ -11,26 +12,23 @@ type BlogPage = Page<CollectionEntry<"blog">>;
1112const { 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 >
You can’t perform that action at this time.
0 commit comments