-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.astro
More file actions
79 lines (70 loc) · 1.4 KB
/
index.astro
File metadata and controls
79 lines (70 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
import Base from "#layouts/Base.astro";
import { getCollection } from "astro:content";
const articles = await getCollection("articles");
---
<Base
title="Yan | Articles"
description="Archive of all my published articles."
id="articles"
>
<main class="flow" id="__page-content">
<h1>Articles</h1>
{articles.length > 0 ? (
<ul class="flow">
{articles.map(({ id, data: { title, description, date } }) => (
<li>
<a href={`/articles/${id}/`}>
<div class="article">
<p class="date">
{Intl.DateTimeFormat("en", { dateStyle: "long" }).format(
date,
)}
</p>
<h2 class="title">{title}</h2>
<p class="description">{description}</p>
</div>
</a>
</li>
))}
</ul>
) : (
<p class="prose">
Perhaps the real articles are the friends we made along the
way. Stay tuned!
</p>
)}
</main>
</Base>
<style>
ul {
list-style: none;
padding: 0;
--flow-space: var(--space-l);
}
li a {
text-decoration: none;
outline-offset: 12px;
outline-color: var(--color-links);
}
.article {
max-width: 65ch;
--flow-space: var(--space-s);
}
.title {
font-size: var(--font-size-0);
margin-bottom: var(--space-xs);
text-wrap: balance;
}
.description,
.date {
font-size: var(--font-size--2);
color: var(--color-text-dim);
}
.description {
text-wrap: pretty;
}
.date {
margin-bottom: var(--space-2xs);
}
</style>