-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: switched routing over! removed unnecessary code
- Loading branch information
1 parent
2c6a424
commit 4a44a10
Showing
2 changed files
with
44 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
import type { GetStaticPaths, InferGetStaticPropsType, PaginateFunction } from 'astro'; | ||
import { MAX_POSTS_PER_PAGE, listAllPosts } from 'src/utils/post'; | ||
import BlogPostsLayout from '../layouts/BlogPosts.astro'; | ||
// eslint-disable-next-line @typescript-eslint/no-use-before-define | ||
type Props = InferGetStaticPropsType<typeof getStaticPaths>; | ||
// List of pages to compile to | ||
export const getStaticPaths = (async ({ paginate }: { paginate: PaginateFunction }) => { | ||
const postsList = await listAllPosts(); | ||
return paginate(postsList, { | ||
pageSize: MAX_POSTS_PER_PAGE | ||
}); | ||
}) satisfies GetStaticPaths; | ||
const { | ||
data: posts, | ||
url, | ||
currentPage, lastPage, | ||
start, end, total, size | ||
} = Astro.props.page; | ||
const BLOG_URL = Astro.site?.href ?? ''; | ||
--- | ||
<BlogPostsLayout | ||
posts={posts} | ||
baseUrl={BLOG_URL} | ||
currentUrl={url.current} | ||
currentPage={currentPage} | ||
lastPage={lastPage} | ||
prevUrl={url.prev} | ||
nextUrl={url.next} | ||
start={start} | ||
end={end} | ||
total={total} | ||
size={size} | ||
> | ||
<Fragment slot="header"> | ||
TorontoJS Blog | ||
</Fragment> | ||
</BlogPostsLayout> |
This file was deleted.
Oops, something went wrong.