feat(blog): added blog posting infrastructure
This commit is contained in:
parent
88c12e7d4f
commit
62b78058a5
6 changed files with 107 additions and 3 deletions
31
src/pages/blog/index.astro
Normal file
31
src/pages/blog/index.astro
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
import { getCollection } from "astro:content";
|
||||
import Main from "../../layouts/MainLayout.astro";
|
||||
import TransFlagPanel from "../../layouts/TransFlagPanel.astro";
|
||||
import Panel from "../../layouts/Panel.astro";
|
||||
import "./index.scss";
|
||||
|
||||
const latestPosts = (await getCollection("blog")).sort(
|
||||
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
|
||||
);
|
||||
---
|
||||
|
||||
<Main title="Blog">
|
||||
<TransFlagPanel>
|
||||
<h1>Blog!!!</h1>
|
||||
</TransFlagPanel>
|
||||
{
|
||||
latestPosts.map((post) => {
|
||||
return (
|
||||
<a href={`/blog/${post.id}`} class="blog-post-link">
|
||||
<Panel
|
||||
title={`${post.data.title} - ${post.data.pubDate.toLocaleString()}`}
|
||||
customClass="blog-post-panel"
|
||||
>
|
||||
<p>{post.data.description}</p>
|
||||
</Panel>
|
||||
</a>
|
||||
);
|
||||
})
|
||||
}
|
||||
</Main>
|
||||
Loading…
Add table
Add a link
Reference in a new issue