+12
src/components/BlogPost.astro
+12
src/components/BlogPost.astro
···
14
display: block;
15
border: 10px double;
16
text-decoration: none;
17
+
margin-bottom: 13px;
18
+
}
19
+
20
+
a:last-child {
21
+
margin-bottom: 0;
22
}
23
24
article {
25
padding: 13px 15px;
26
+
overflow: hidden;
27
+
}
28
+
29
+
article h3 {
30
+
white-space: nowrap;
31
+
overflow: hidden;
32
+
text-overflow: ellipsis;
33
}
34
35
time {
+23
src/layouts/SinglePage.astro
+23
src/layouts/SinglePage.astro
···
···
1
+
---
2
+
import "../styles/main.css";
3
+
import Toolbar from "../components/Toolbar.astro";
4
+
5
+
const { backlink } = Astro.props;
6
+
---
7
+
8
+
<Toolbar {backlink} />
9
+
<div class="wrapper bwcontainer">
10
+
<header class="bwbox">
11
+
<slot name="header" />
12
+
</header>
13
+
<main class="bwbox">
14
+
<slot />
15
+
</main>
16
+
</div>
17
+
18
+
<style>
19
+
.wrapper {
20
+
max-width: 82ch;
21
+
margin: 0 auto;
22
+
}
23
+
</style>
+33
src/pages/blog.astro
+33
src/pages/blog.astro
···
···
1
+
---
2
+
import { getCollection } from "astro:content";
3
+
import Base from "../components/Base.astro";
4
+
import SinglePage from "../layouts/SinglePage.astro";
5
+
import BlogPost from "../components/BlogPost.astro";
6
+
7
+
const post = await getCollection("blog").then((x) =>
8
+
x.sort(
9
+
(a, b) =>
10
+
(b.data.pub as unknown as number) - (a.data.pub as unknown as number),
11
+
),
12
+
);
13
+
---
14
+
15
+
<Base
16
+
title="BLOG"
17
+
graph={{
18
+
description: "Blog posts and such.",
19
+
}}
20
+
>
21
+
<SinglePage>
22
+
<h1 slot="header" class="center">Blog posts</h1>
23
+
{
24
+
post.map((post) => (
25
+
<BlogPost
26
+
url={`/blog/${post.id}`}
27
+
title={post.data.title}
28
+
time={`${post.data.pub.getFullYear()}-${post.data.pub.getMonth() + 1}-${post.data.pub.getDate()}`}
29
+
/>
30
+
))
31
+
}
32
+
</SinglePage>
33
+
</Base>
+1
src/pages/home.astro
+1
src/pages/home.astro