-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.astro
104 lines (101 loc) · 3.58 KB
/
index.astro
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
import Base from "@/layouts/BaseLayout.astro";
import FormattedDate from "@/components/FormattedDate.astro";
import { getCollection } from "astro:content";
const pages = await getCollection("pages", ({ data }) => {
return import.meta.env.PROD ? data.draft !== true : true;
});
---
<Base>
<section>
<h2 class="mb-2 font-bold">Pinned</h2>
<ul class="-mb-2 divide-y divide-dashed border-t-2">
<li class="flex gap-6 py-2">
<FormattedDate date={new Date()} class="flex-shrink-0 text-secondary" />
<a href="/notes" class="underline"> Notes</a>
</li>
{
pages
.filter((page) => page.data.pinned)
.sort((a, b) => {
const aDate = a.data.updated || a.data.published;
const bDate = b.data.updated || b.data.published;
return Date.parse(bDate.toString()) - Date.parse(aDate.toString());
})
.map((page) => {
return (
<li class="flex gap-6 py-2">
<FormattedDate
date={page.data.updated || page.data.published}
class="flex-shrink-0 text-secondary"
/>
<a href={page.slug} class="underline">
{page.data.title}
</a>
</li>
);
})
}
</ul>
</section>
<section class="mt-6">
<h2 class="mb-2 font-bold">Latest</h2>
<ul class="-mb-2 divide-y divide-dashed border-t-2">
{
pages
.filter((page) => !page.data.pinned)
.sort((a, b) => {
const aDate = a.data.updated || a.data.published;
const bDate = b.data.updated || b.data.published;
return Date.parse(bDate.toString()) - Date.parse(aDate.toString());
})
.map((page) => {
return (
<li class="flex gap-6 py-2">
<FormattedDate
date={page.data.updated || page.data.published}
class="flex-shrink-0 text-secondary"
/>
<a
href={page.slug}
class:list={[
"underline",
page.data.draft && "text-secondary",
]}
>
{page.data.title}
</a>
</li>
);
})
}
</ul>
</section>
<footer class="relative mt-8 border-t-2 pt-3 text-center">
<p class="text-sm text-secondary uppercase tracking-wide">
If you're reading this,<br /> all systems operational
</p>
<p class="mt-2 text-highlight flex justify-center">
<a
href="https://info.cern.ch/hypertext/WWW/TheProject.html"
class="size-5 rounded-full"
>
<span class="sr-only">World Wide Web</span>
<svg
aria-hidden
fill="none"
viewBox="0 0 24 24"
stroke-width="1"
stroke="currentColor"
class="size-5"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418"
></path>
</svg>
</a>
</p>
</footer>
</Base>