Skip to content

Commit 51cad46

Browse files
committed
init
1 parent 99914f2 commit 51cad46

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: 合同新歓を開催します
3+
image: ./thumbnail.png
4+
description: 東大エンジニア系サークル合同新歓を開催します
5+
categories:
6+
- event
7+
author: ykobayashi
8+
date: 2025-03-24
9+
---
10+
59.7 KB
Loading

src/layouts/meta.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const url = Astro.url.href;
2121
/>
2222
<meta property="og:site_name" content="ut.code();" />
2323
<meta property="og:title" content={title} />
24+
{description && <meta property="og:description" content={description} />}
2425
<meta property="og:image" content={image.src} />
2526
<meta property="og:url" content={url} />
2627
<meta property="og:locale" content="ja_JP" />

src/pages/articles/[...id].astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export async function getStaticPaths() {
1717
const { article } = Astro.props;
1818
const { Content } = await render(article);
1919
const author =
20-
article.data.author && (await getEntry("members", article.data.author?.id));
20+
article.data.author && (await getEntry("members", article.data.author.id));
2121
if (article.data.author && !author)
2222
throw new Error(
2323
`Author not found for article ${article.id}, searched for author ${article.data.author.id}`,
@@ -26,7 +26,8 @@ if (article.data.author && !author)
2626

2727
<GlobalLayout
2828
title={article.data.title}
29-
description="ut.code(); のウェブサイトに書かれた記事のひとつです。"
29+
description={article.data.description ||
30+
"ut.code(); のウェブサイトに書かれた記事のひとつです。"}
3031
focus={Focus.articles}
3132
image={article.data.image}
3233
>

src/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const CreateArticleSchema = ({ image }: { image: ImageFunction }) =>
1212
.date()
1313
.transform((date) => new TZDate(date).withTimeZone("Asia/Tokyo")),
1414
title: z.string().nullable(),
15+
description: z.string().optional(), // og:description に使われます
1516
image: image(),
1617
categories: z.array(z.string()).optional(),
1718
author: reference("members").optional(),

0 commit comments

Comments
 (0)