From 097e4862d96cc009990ebf95f0169ec55cd0f844 Mon Sep 17 00:00:00 2001
From: aster <137767097+aster-void@users.noreply.github.com>
Date: Tue, 25 Mar 2025 16:46:40 +0900
Subject: [PATCH 1/2] can configure crops
---
.../2024/11-26_komaba-festival/index.mdx | 1 +
.../2024/12-21_kick-off-party-report/index.mdx | 1 +
contents/articles/README.md | 17 +++++++++++++++++
src/components/ArticleList.astro | 17 +++++++++++++++--
src/schema.ts | 4 +++-
5 files changed, 37 insertions(+), 3 deletions(-)
create mode 100644 contents/articles/README.md
diff --git a/contents/articles/2024/11-26_komaba-festival/index.mdx b/contents/articles/2024/11-26_komaba-festival/index.mdx
index ff69e739..858139dc 100644
--- a/contents/articles/2024/11-26_komaba-festival/index.mdx
+++ b/contents/articles/2024/11-26_komaba-festival/index.mdx
@@ -5,6 +5,7 @@ categories:
- events
image: ./image1.jpg
author: kmanabe
+position: top
---
ut.code(); は、2024 年 11 月 22 〜 24 日の合計 3 日間駒場祭に企画を出展しました。今回も多くの方にお越しいただきました。3 日間を通して来場してくださった皆様、ありがとうございました!
diff --git a/contents/articles/2024/12-21_kick-off-party-report/index.mdx b/contents/articles/2024/12-21_kick-off-party-report/index.mdx
index b73dfbbb..de523c87 100644
--- a/contents/articles/2024/12-21_kick-off-party-report/index.mdx
+++ b/contents/articles/2024/12-21_kick-off-party-report/index.mdx
@@ -5,6 +5,7 @@ categories:
- events
image: ./image.jpg
author: snakamura
+fit: contain
---
ut.code(); では 2024 年 12 月 21 日にプロジェクト発足会を行いました。
diff --git a/contents/articles/README.md b/contents/articles/README.md
new file mode 100644
index 00000000..3d4f0c6f
--- /dev/null
+++ b/contents/articles/README.md
@@ -0,0 +1,17 @@
+# 記事ページ
+
+## frontmatter
+
+| キー | 必須 | 説明 |
+| ------------- | ---- | ---|
+| `title` | ✅ | 記事タイトル|
+| `date` | ✅ | **記事を書いた** 日。|
+| `image` | ✅ | イメージ画像 |
+| `fit` | | (画像) object-fit。 default = "cover" |
+| `position` | | (画像) object-position。 (縦軸上から 横軸左から)。default = "50% 50%" |
+| `categories` | | 何なんだろうね。 |
+| `author`| | 著者の id |
+
+## 画像
+
+縦横比 3:5 に crop されます。
diff --git a/src/components/ArticleList.astro b/src/components/ArticleList.astro
index e9e4256d..3a5d6b97 100644
--- a/src/components/ArticleList.astro
+++ b/src/components/ArticleList.astro
@@ -52,6 +52,14 @@ const articlesWithExcerpts = await Promise.all(
{
articlesWithExcerpts.map(({ article, text }, i) => {
const isFeatured = enlarge && i % 11 === 0; // 11 記事ごとに大きく表示する
+ const baseW = 400;
+ const imageWidth = baseW * (isFeatured ? 2 : 1);
+ const imageHeight = baseW * (3 / 5) * (isFeatured ? 2 : 1);
+
+ article.data.fit ??= "cover";
+ article.data.position ??= "center";
+ console.log(article.data);
+
const additionalProps = isFeatured
? {
cellClassName: "md:col-span-2 md:row-span-2",
@@ -75,12 +83,17 @@ const articlesWithExcerpts = await Promise.all(