mirror of
https://github.com/valentineus/popov.link.git
synced 2025-07-03 16:10:26 +03:00
chore: update blog routing and header link
- Removed the redirects for the blog route in the configuration. - Updated the blog link in the Header component to include a trailing slash. - Added a new index page for the blog to display all posts.
This commit is contained in:
@ -15,10 +15,4 @@ export default defineConfig({
|
|||||||
theme: "vitesse-dark",
|
theme: "vitesse-dark",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
redirects: {
|
|
||||||
"/blog": {
|
|
||||||
destination: "/",
|
|
||||||
status: 301,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -18,5 +18,5 @@
|
|||||||
|
|
||||||
<header>
|
<header>
|
||||||
<a href="/">Home</a>
|
<a href="/">Home</a>
|
||||||
<a href="/blog">Blog</a>
|
<a href="/blog/">Blog</a>
|
||||||
</header>
|
</header>
|
||||||
|
17
src/pages/blog/index.astro
Normal file
17
src/pages/blog/index.astro
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
import { getCollection } from "astro:content";
|
||||||
|
import Layout from "../../layouts/BaseLayout.astro";
|
||||||
|
import PostSummary from "../../components/PostSummary.astro";
|
||||||
|
|
||||||
|
const posts = await getCollection("blog", ({ data }) => {
|
||||||
|
return data.draft !== true;
|
||||||
|
});
|
||||||
|
|
||||||
|
posts.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime());
|
||||||
|
---
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<section style={{ "margin-top": "3rem" }}>
|
||||||
|
{posts.map((post) => <PostSummary post={post} />)}
|
||||||
|
</section>
|
||||||
|
</Layout>
|
Reference in New Issue
Block a user