aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-06-21 19:41:03 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-06-21 19:41:03 +0900
commit6fa8872f6b4be562d62f992a4ba85a1ed75136af (patch)
tree40a55a703d93f5a1150882ba087b06e27b131b12 /src/components
parent6bf6085fcbe2e8fa8cfa6d4265b7eb58c35c2b2a (diff)
QuestionSummary に about プロパティを追加し @graph 構造に変更
JSON-LD を WebPage + FAQPage の @graph 構造に変更し、 WebPage.about で質問の主題を明示するようにした。 - about は frontmatter の tags から推測(初回の非「一般質問」タグ) - 64ページすべてに about を追加済み - AGENTS.md の使用例も更新
Diffstat (limited to 'src/components')
-rw-r--r--src/components/QuestionSummary.astro45
1 files changed, 30 insertions, 15 deletions
diff --git a/src/components/QuestionSummary.astro b/src/components/QuestionSummary.astro
index 96ec6f8..9b70955 100644
--- a/src/components/QuestionSummary.astro
+++ b/src/components/QuestionSummary.astro
@@ -12,6 +12,7 @@
*
* <QuestionSummary
* headline="ページのタイトル"
+ * about="障害者虐待"
* datePublished="2025-06-06"
* qa={[
* { question: "① 質問文", answer: "答弁テキスト", anchor: "-見出し名" },
@@ -25,7 +26,8 @@
* - question: 表の「質問」列の内容(番号付きで)
* - answer: 表の「答弁概要」列のテキスト(リンク構文なしのプレーンテキスト)
* - anchor: 詳細セクションへのアンカー(見出しから自動生成されるID)
- * - headline: ページのタイトル(JSON-LD の headline に使われる)
+ * - headline: ページのタイトル
+ * - about: 質問の主題(1〜3語のキーワード。JSON-LD WebPage.about に使われる)
* - datePublished: 質問日(ISO 8601: YYYY-MM-DD)
*/
@@ -43,29 +45,42 @@ export interface Props {
qa: QA[];
/** ページの表題 */
headline?: string;
+ /** 質問の主題(1〜3語。例: "障害者虐待"、"いじめ重大事態"、"公文書管理") */
+ about?: string;
/** 公開日(ISO 8601形式: YYYY-MM-DD) */
datePublished?: string;
}
-const { qa, headline, datePublished } = Astro.props;
+const { qa, headline, about, datePublished } = Astro.props;
---
{
qa.length > 0 && (
<script type="application/ld+json" is:inline set:html={JSON.stringify({
- "@context": "https://schema.org",
- "@type": "FAQPage",
- ...(headline && { headline }),
- ...(datePublished && { datePublished }),
- "mainEntity": qa.map((item) => ({
- "@type": "Question",
- "name": item.question,
- "acceptedAnswer": {
- "@type": "Answer",
- "text": item.answer,
- },
- })),
-})} />
+ "@context": "https://schema.org",
+ "@graph": [
+ {
+ "@type": "WebPage",
+ ...(headline && { name: headline }),
+ ...(about && { about: { "@type": "Thing", name: about } }),
+ ...(datePublished && { datePublished }),
+ "mainEntity": { "@id": "#faq" },
+ },
+ {
+ "@type": "FAQPage",
+ "@id": "#faq",
+ ...(headline && { headline }),
+ "mainEntity": qa.map((item) => ({
+ "@type": "Question",
+ "name": item.question,
+ "acceptedAnswer": {
+ "@type": "Answer",
+ "text": item.answer,
+ },
+ })),
+ },
+ ].filter(Boolean),
+ })} />
)
}