From 89a153ddffffcc7210d699096c5cc76ca4c58404 Mon Sep 17 00:00:00 2001
From: miyaji255 <84168445+miyaji255@users.noreply.github.com>
Date: Sat, 3 Feb 2024 19:29:03 +0900
Subject: [PATCH 1/7] =?UTF-8?q?#55=20=E3=82=BF=E3=82=B0=E3=82=AB=E3=83=86?=
=?UTF-8?q?=E3=82=B4=E3=83=AA=E3=83=BC=E3=82=92=E8=BF=BD=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/blog/BlogTitle.astro | 2 +-
src/components/blog/tag/TagCategoryNav.astro | 34 +++++
src/components/blog/tag/TagListPage.astro | 42 +++++
src/components/blog/tag/TagListSection.astro | 1 +
src/components/layout/nav/BlogNav.astro | 24 +--
src/content/_schema.json | 143 ++++++++++--------
src/content/_schema.ts | 3 +
src/content/config.ts | 13 ++
src/content/tags/advent-calendar.json | 3 +-
src/content/tags/arduino.json | 1 +
src/content/tags/asp.net.json | 1 +
src/content/tags/astro.json | 1 +
src/content/tags/automation.json | 3 +-
src/content/tags/blender.json | 3 +-
src/content/tags/c-cpp.json | 1 +
src/content/tags/csharp.json | 1 +
src/content/tags/discord-bot.json | 1 +
src/content/tags/docker.json | 1 +
src/content/tags/dotnet.json | 1 +
src/content/tags/electronic-dictionary.json | 1 +
src/content/tags/fashion.json | 3 +-
src/content/tags/for-beginer.json | 3 +-
src/content/tags/git.json | 1 +
src/content/tags/go.json | 1 +
src/content/tags/javascript.json | 3 +-
src/content/tags/mad.json | 3 +-
src/content/tags/markdown.json | 1 +
src/content/tags/mixamo.json | 3 +-
src/content/tags/open-cv.json | 3 +-
src/content/tags/open-xml.json | 3 +-
src/content/tags/oracle-cloud.json | 3 +-
src/content/tags/power-point.json | 3 +-
src/content/tags/python.json | 1 +
src/content/tags/reaper.json | 3 +-
src/content/tags/rest-api.json | 1 +
src/content/tags/rust.json | 1 +
src/content/tags/shell.json | 1 +
src/content/tags/tello.json | 1 +
src/content/tags/transcribe.json | 3 +-
src/content/tags/typst.json | 1 +
src/content/tags/unity.json | 1 +
src/content/tags/vrchat.json | 3 +-
src/content/tags/vrm.json | 3 +-
src/content/tags/whisper.json | 3 +-
src/content/tags/winforms.json | 1 +
src/content/tags/workshop.json | 3 +-
src/pages/blog/tags/[category].astro | 15 ++
.../tags/{[slug]/index.astro => [slug].astro} | 0
src/pages/blog/tags/index.astro | 33 +---
49 files changed, 262 insertions(+), 122 deletions(-)
create mode 100644 src/components/blog/tag/TagCategoryNav.astro
create mode 100644 src/components/blog/tag/TagListPage.astro
create mode 100644 src/pages/blog/tags/[category].astro
rename src/pages/blog/tags/{[slug]/index.astro => [slug].astro} (100%)
diff --git a/src/components/blog/BlogTitle.astro b/src/components/blog/BlogTitle.astro
index df59775..b21e9f6 100644
--- a/src/components/blog/BlogTitle.astro
+++ b/src/components/blog/BlogTitle.astro
@@ -11,7 +11,7 @@ const { title, background } = Astro.props
class:list={[
'bg-dot flex items-center justify-center gap-x-5 py-6 text-6xl',
{
- 'bg-dot-white': background === 'white',
+ 'bg-dot-white border-t': background === 'white',
'bg-dot-primary': background === 'primary',
'bg-dot-secondary': background === 'secondary',
},
diff --git a/src/components/blog/tag/TagCategoryNav.astro b/src/components/blog/tag/TagCategoryNav.astro
new file mode 100644
index 0000000..5be7d4c
--- /dev/null
+++ b/src/components/blog/tag/TagCategoryNav.astro
@@ -0,0 +1,34 @@
+---
+import { TagCategoryMapping, type TagCategory } from '@/content/config'
+
+export type TagNavCategory = 'all' | TagCategory
+
+interface Props {
+ category: TagNavCategory
+}
+const { category } = Astro.props
+const tagCategoryEntries = [['all', '全般'], ...TagCategoryMapping] as const
+---
+
+
diff --git a/src/components/blog/tag/TagListPage.astro b/src/components/blog/tag/TagListPage.astro
new file mode 100644
index 0000000..a1f4415
--- /dev/null
+++ b/src/components/blog/tag/TagListPage.astro
@@ -0,0 +1,42 @@
+---
+import BlogLayout from '@/layouts/BlogLayout.astro'
+import { getCollection } from 'astro:content'
+import { getTagStatistics } from '@/content/_blog-statistics'
+import TagListSection from '@/components/blog/tag/TagListSection.astro'
+import type { TagNavCategory } from './TagCategoryNav.astro'
+import TagCategoryNav from './TagCategoryNav.astro'
+
+interface Props {
+ category: TagNavCategory
+}
+
+const { category } = Astro.props
+const [tagEntries, statistics] = await Promise.all([
+ getCollection('tags'),
+ getTagStatistics(),
+] as const)
+
+const tags = tagEntries
+ .filter((tag) => category === 'all' || category === tag.data.category)
+ .map((tag) => ({
+ ...tag,
+ articleCount: statistics[tag.id].length,
+ lastPostedTime: statistics[tag.id][0]?.time ?? 0,
+ }))
+tags.sort((tag1, tag2) =>
+ tag2.articleCount !== tag1.articleCount
+ ? tag2.articleCount - tag1.articleCount
+ : tag2.lastPostedTime - tag1.lastPostedTime,
+)
+---
+
+