fix: url `/page/1` -> `/`, `/page/2` -> `/2`
This commit is contained in:
parent
bd17b39fd2
commit
90070d06c1
|
@ -70,9 +70,6 @@ export default defineConfig({
|
|||
],
|
||||
],
|
||||
},
|
||||
redirects: {
|
||||
"/": "/page/1",
|
||||
},
|
||||
vite: {
|
||||
plugins: [yaml()],
|
||||
css: {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
import MainGridLayout from "../layouts/MainGridLayout.astro";
|
||||
import PostCard from "../components/PostCard.astro";
|
||||
import Pagination from "../components/control/Pagination.astro";
|
||||
import {getSortedPosts} from "../utils/content-utils";
|
||||
import {getPostUrlBySlug} from "../utils/url-utils";
|
||||
import {PAGE_SIZE} from "../constants/constants";
|
||||
import PostPage from "../components/PostPage.astro";
|
||||
|
||||
export async function getStaticPaths({ paginate }) {
|
||||
const allBlogPosts = await getSortedPosts();
|
||||
return paginate(allBlogPosts, { pageSize: PAGE_SIZE });
|
||||
}
|
||||
|
||||
const {page} = Astro.props;
|
||||
|
||||
---
|
||||
|
||||
<MainGridLayout>
|
||||
<PostPage page={page}></PostPage>
|
||||
<Pagination class="mx-auto" page={page}></Pagination>
|
||||
</MainGridLayout>
|
|
@ -1,36 +0,0 @@
|
|||
---
|
||||
import MainGridLayout from "@layouts/MainGridLayout.astro";
|
||||
import TitleCard from "@components/TitleCardNew.astro";
|
||||
import Pagination from "@components/control/Pagination.astro";
|
||||
import {getSortedPosts} from "@utils/content-utils";
|
||||
import {getPostUrlBySlug} from "@utils/url-utils";
|
||||
|
||||
export async function getStaticPaths({ paginate }) {
|
||||
const allBlogPosts = await getSortedPosts();
|
||||
return paginate(allBlogPosts, { pageSize: 8 });
|
||||
}
|
||||
|
||||
const {page} = Astro.props;
|
||||
|
||||
---
|
||||
|
||||
<MainGridLayout>
|
||||
<div class="transition flex flex-col rounded-[var(--radius-large)] bg-[var(--card-bg)] py-1 md:py-0 md:bg-transparent md:gap-4 mb-4">
|
||||
{page.data.map((entry: { data: { draft: boolean; title: string; tags: string[]; category: string; published: Date; image: string; description: string; }; slug: string; }) => {
|
||||
return (
|
||||
<TitleCard
|
||||
entry={entry}
|
||||
title={entry.data.title}
|
||||
tags={entry.data.tags}
|
||||
category={entry.data.category}
|
||||
published={entry.data.published}
|
||||
url={getPostUrlBySlug(entry.slug)}
|
||||
image={entry.data.image}
|
||||
description={entry.data.description}
|
||||
draft={entry.data.draft}
|
||||
></TitleCard>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<Pagination class="mx-auto" page={page}></Pagination>
|
||||
</MainGridLayout>
|
10
vercel.json
10
vercel.json
|
@ -1,9 +1 @@
|
|||
{
|
||||
"redirects": [
|
||||
{
|
||||
"source": "/",
|
||||
"destination": "/page/1",
|
||||
"statusCode": 307
|
||||
}
|
||||
]
|
||||
}
|
||||
{}
|
||||
|
|
Loading…
Reference in New Issue