Skip to content

Commit 54da481

Browse files
committed
Set up local blog
1 parent 2f3809f commit 54da481

File tree

9 files changed

+168
-140
lines changed

9 files changed

+168
-140
lines changed

cspell.config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ ignorePaths:
3333
ignoreRegExpList:
3434
- <!--.*--> # ignore HTML comments
3535
- '@[A-Za-z0-9-_]+' # ignore social handles
36+
- '"[a-z0-9-]+"' # ignore SLUGS

cspell/terminology.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ orcid
3333
pagefind
3434
prophoto-rgb
3535
respec
36+
roundtable
3637
secno
3738
shiki
3839
sotd
@@ -43,4 +44,4 @@ tocsidebar
4344
unbuilt
4445
wireframing
4546
workstreams
46-
wght
47+
wght

www/src/content.config.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { z, defineCollection } from 'astro:content';
2+
import { file, glob } from 'astro/loaders';
3+
4+
const DATE = z
5+
.string()
6+
.or(z.date())
7+
.transform((val) => new Date(val));
8+
9+
const w3c = defineCollection({
10+
loader: file('src/content/w3c.json'),
11+
schema: () =>
12+
z.object({
13+
title: z.string(),
14+
date: DATE,
15+
author: z.string(),
16+
url: z.string(),
17+
}),
18+
});
19+
20+
const posts = defineCollection({
21+
loader: glob({ pattern: ['*.md'], base: 'src/content/posts' }),
22+
schema: () =>
23+
z.object({
24+
title: z.string(),
25+
date: DATE,
26+
description: z.optional(z.string()),
27+
author: z.string(),
28+
tags: z.optional(z.array(z.string())),
29+
}),
30+
});
31+
32+
export const collections = {
33+
posts,
34+
w3c,
35+
};

www/src/content/config.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

www/src/content/posts.ts

Lines changed: 0 additions & 54 deletions
This file was deleted.

www/src/content/w3c.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[
2+
{
3+
"id": "call-to-read-the-first-public-editors-draft-and-share-feedback",
4+
"title": "Call to read the First Public Editor's Draft and share feedback",
5+
"date": "2021-09-23",
6+
"author": "Kaelig Deloumeau-Prigent",
7+
"url": "https://www.w3.org/community/design-tokens/2021/09/23/call-to-read-the-first-public-editors-draft-and-share-feedback/"
8+
},
9+
{
10+
"id": "upcoming-event-tool-vendor-roundtable",
11+
"title": "Upcoming event: design tool vendor roundtable",
12+
"date": "2021-03-09",
13+
"author": "Kaelig Deloumeau-Prigent",
14+
"url": "https://www.w3.org/community/design-tokens/2021/03/09/upcoming-event-design-tool-vendor-roundtable/"
15+
},
16+
{
17+
"id": "status-update-february-2021",
18+
"title": "Status update (February 2021)",
19+
"date": "2021-02-15",
20+
"author": "James Nash",
21+
"url": "https://www.w3.org/community/design-tokens/2021/02/15/status-update-february-2021/"
22+
},
23+
{
24+
"id": "first-editors-draft-shared-with-design-tooling-vendors",
25+
"title": "First Editor's Draft shared with design tooling vendors",
26+
"date": "2021-04-17",
27+
"author": "Kaelig Deloumeau-Prigent",
28+
"url": "https://www.w3.org/community/design-tokens/2021/04/17/first-editors-draft-shared-with/"
29+
},
30+
{
31+
"id": "call-to-implement-the-second-editors-draft-and-share-feedback",
32+
"title": "Call to implement the Second Editors' Draft and share feedback",
33+
"date": "2022-06-14",
34+
"author": "Kaelig Deloumeau-Prigent",
35+
"url": "https://www.w3.org/community/design-tokens/2022/06/14/call-to-implement-the-second-editors-draft-and-share-feedback/"
36+
},
37+
{
38+
"id": "request-for-comments-new-resolver-specification-groups-aliases-updates",
39+
"title": "Request For Comments: new Resolver specification, groups & Aliases updates",
40+
"date": "2025-09-12",
41+
"author": "Kaelig Deloumeau-Prigent",
42+
"url": "https://www.w3.org/community/design-tokens/2025/09/12/request-for-comments-new-resolver-specification-groups-aliases-updates/"
43+
},
44+
{
45+
"id": "design-tokens-specification-reaches-first-stable-version",
46+
"title": "Design Tokens specification reaches first stable version",
47+
"date": "2025-10-28",
48+
"author": "Kaelig Deloumeau-Prigent",
49+
"url": "https://www.w3.org/community/design-tokens/2025/10/28/design-tokens-specification-reaches-first-stable-version/"
50+
}
51+
]

www/src/pages/blog.astro

Lines changed: 0 additions & 62 deletions
This file was deleted.

www/src/pages/blog/[id].astro

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
import Base from '@/layouts/Base.astro';
3+
import { getCollection, render } from 'astro:content';
4+
5+
export async function getStaticPaths() {
6+
const posts = await getCollection('posts');
7+
return posts.map((post) => ({
8+
params: { id: post.id },
9+
props: { post },
10+
}));
11+
}
12+
13+
const { post } = Astro.props;
14+
const { Content } = await render(post);
15+
---
16+
17+
<Base title={post.data.title}>
18+
<Content />
19+
</Base>

www/src/pages/blog/index.astro

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
import { getCollection } from 'astro:content';
3+
import { getW3FormattedDate, getFormattedDate } from '@/utils/date.utils';
4+
import Base from '@/layouts/Base.astro';
5+
import Text from '@/components/Text/Text.astro';
6+
import Stack from '@/components/Stack/Stack.astro';
7+
import { Icon } from 'astro-icon/components';
8+
9+
const title = 'Blog';
10+
11+
const posts = await getCollection('posts');
12+
const w3c = await getCollection('w3c');
13+
14+
const sortedPosts = [...posts, ...w3c].sort(
15+
(a, b) => b.data.date.getTime() - a.data.date.getTime(),
16+
);
17+
---
18+
19+
<Base title={title}>
20+
<Stack as="ul" gap={12} axis="y" class="blog-list u-list-style:none">
21+
{
22+
sortedPosts.map((post) => (
23+
<li>
24+
<Stack as="article" gap={2} class="article">
25+
{post.collection === 'w3c' ? (
26+
<a href={post.data.url} target="_blank">
27+
{post.data.title}
28+
<Icon
29+
name="external"
30+
aria-label="External link"
31+
role="graphics-symbol img"
32+
/>
33+
</a>
34+
) : (
35+
<a href={`/blog/${post.id}`}>{post.data.title}</a>
36+
)}
37+
<Text as="p" variant="sm">
38+
<time datetime={getW3FormattedDate(post.data.date)}>
39+
{getFormattedDate(post.data.date)}
40+
</time>
41+
</Text>
42+
</Stack>
43+
</li>
44+
))
45+
}
46+
</Stack>
47+
</Base>
48+
49+
<style lang="scss">
50+
.article {
51+
p {
52+
margin: 0;
53+
}
54+
}
55+
56+
.blog-list {
57+
margin: 0;
58+
padding: 0;
59+
}
60+
</style>

0 commit comments

Comments
 (0)