# BYAI Site Schema v1

BYAI（https://byai.page）にアップロードするサイトデータの仕様です。

## Site Schema v1

サイト全体を 1 つの JSON で表します。HTML / CSS / JavaScript は書きません（BYAI がこの JSON からレスポンシブな HTML を生成します）。

### 全体構造

```json
{
  "schemaVersion": 1,
  "site": {
    "title": "サイト名（必須・120文字以内）",
    "description": "サイトの説明（検索結果に表示。400文字以内）",
    "lang": "ja",
    "logoText": "ヘッダーに表示するロゴ文字（省略時は title）",
    "theme": {
      "primary": "#2563eb",
      "accent": "#f59e0b",
      "background": "#ffffff",
      "text": "#1f2937",
      "font": "sans",
      "radius": "md"
    },
    "nav": [ { "label": "ホーム", "href": "/" }, { "label": "サービス", "href": "/service" } ],
    "footer": { "text": "© 2026 サイト名", "links": [ { "label": "お問い合わせ", "href": "/contact" } ] },
    "favicon": "https://...（省略可。タブに表示するアイコン画像）",
    "ogImage": "https://...（省略可。SNS で共有されたときの画像）",
    "redirects": [ { "from": "/old-page", "to": "/new-page", "status": 301 } ]
  },
  "pages": [
    {
      "path": "/",
      "title": "ページタイトル（必須）",
      "description": "このページの説明（400文字以内）",
      "noindex": false,
      "sections": [ /* セクションの配列（1〜40件） */ ]
    }
  ]
}
```

- `theme` の色は `#rrggbb` 形式。`font`: `sans` / `serif` / `rounded`。`radius`: `none` / `sm` / `md` / `lg`
- `pages[].path`: `"/"`（トップ・必須）または `"/about"` `"/service/web"` の形式。英小文字・数字・ハイフンのみ、末尾スラッシュなし、最大 4 階層、重複不可
- `nav` は最大 8 件
- `favicon` / `ogImage`（省略可）: https:// で始まる実在の画像 URL のみ。無ければ指定しない
- `redirects`（省略可・最大 50 件）: 旧 URL からの転送。`from` は pages に存在しないパス、`to` は `/path` または `https://...`、`status` は 301（恒久）または 302（一時）。サイトをリニューアルして URL が変わる場合にだけ使う

### リンク（href）

使用できる形式: `/about`（サイト内。必ず pages に存在するパス）、`#anchor`、`https://...`、`mailto:...`、`tel:...`

### 画像

`{ "src": "https://...", "alt": "画像の説明" }`。`src` は **https:// で始まる実在の画像 URL のみ**。実在する画像 URL が無い場合は画像を使わないでください（URL を創作しない）。

### テキストの書式

`body` / `a` / `quote` などの長文フィールドでは次だけ使えます: 空行で段落、改行、行頭 `- ` で箇条書き、`**太字**`、`[リンク文字](https://...)`。HTML タグは使えません（そのまま文字として表示されます）。

### セクション一覧

すべてのセクションに共通で指定できる項目: `"id": "anchor-name"`（ページ内リンク用・省略可）、`"background": "default" | "muted" | "primary"`（背景。省略時 default）

| type | 用途 | 項目 |
|---|---|---|
| `hero` | ページ冒頭の大見出し | `heading`（必須）, `subheading`, `image`, `buttons`: [{label, href, variant: "primary"\|"secondary"}]（最大3）, `align`: "center"\|"left" |
| `text` | 文章 | `heading`, `body`（必須）, `align`: "left"\|"center" |
| `features` | 特徴・サービス一覧（カード） | `heading`, `lead`, `columns`: 2\|3\|4, `items`: [{icon（絵文字1つ）, title（必須）, body}] |
| `image` | 画像 1 枚 | `image`（必須）, `caption` |
| `gallery` | 画像ギャラリー | `heading`, `images`: [{src, alt}] |
| `cta` | 行動喚起 | `heading`（必須）, `body`, `button`: {label, href, variant}（必須） |
| `faq` | よくある質問 | `heading`, `items`: [{q, a}] |
| `pricing` | 料金表 | `heading`, `lead`, `plans`: [{name, price, period, features: [文字列], button, highlighted: true\|false}] |
| `testimonials` | お客様の声 | `heading`, `items`: [{quote, name, role}] |
| `steps` | 手順・流れ | `heading`, `items`: [{title, body}] |
| `table` | 表（会社概要など） | `heading`, `headers`: [文字列]（省略可）, `rows`: [[文字列, ...]] |
| `contact` | 連絡先 | `heading`, `body`, `items`: [{label, value, href}] |
| `form` | お問い合わせフォーム（送信内容はサイト管理者にメール通知され、BYAI の管理画面で確認できる） | `heading`, `body`, `fields`: [{name, label, type, required, placeholder, options}]（1〜20件）, `submitLabel`, `successMessage` |
| `embed` | 動画・地図 | `heading`, `kind`: "youtube"\|"map", `url`（YouTube の動画 URL、または Google マップの埋め込み URL https://www.google.com/maps/embed?...） |

- `form` の `fields[].name` は英小文字で始まる英小文字・数字・アンダースコア（例: `name`, `email`, `message`）でフォーム内で重複不可。`type`: `text` / `email` / `tel` / `textarea` / `select`（`options` 必須）/ `checkbox` / `file`（添付ファイル。PDF・画像 5 MB まで、1 フォーム 2 個まで。必要な場合だけ使う）。返信できるよう `type: "email"` の項目を 1 つ入れることを推奨
- 各セクションの `items` / `plans` / `images` は最大 24 件
- 文字数上限: 見出し・ラベル 120 文字、説明 400 文字、本文 6000 文字
- 上記以外の type や、表にない項目は使えません

### 例

```json
{
  "schemaVersion": 1,
  "site": {
    "title": "山田デザイン事務所",
    "description": "東京・世田谷の小さなデザイン事務所。ロゴ・Web・印刷物の制作。",
    "theme": { "primary": "#0f766e", "accent": "#f59e0b", "background": "#ffffff", "text": "#1f2937", "font": "sans", "radius": "md" },
    "nav": [ { "label": "ホーム", "href": "/" }, { "label": "サービス", "href": "/service" }, { "label": "お問い合わせ", "href": "/contact" } ],
    "footer": { "text": "© 2026 山田デザイン事務所", "links": [] }
  },
  "pages": [
    {
      "path": "/",
      "title": "山田デザイン事務所",
      "description": "ロゴ・Web・印刷物のデザイン制作。",
      "sections": [
        { "type": "hero", "heading": "伝わるデザインを、ていねいに。", "subheading": "ロゴから Web サイトまで、小さな会社とお店のためのデザイン事務所です。", "buttons": [ { "label": "サービスを見る", "href": "/service" }, { "label": "相談する", "href": "/contact", "variant": "secondary" } ] },
        { "type": "features", "heading": "できること", "columns": 3, "items": [ { "icon": "🎨", "title": "ロゴ制作", "body": "想いを形にするロゴをご提案します。" }, { "icon": "💻", "title": "Web 制作", "body": "スマホでも見やすいサイトを作ります。" }, { "icon": "🖨️", "title": "印刷物", "body": "名刺・チラシ・パンフレットに対応。" } ] },
        { "type": "cta", "background": "primary", "heading": "まずはお気軽にご相談ください", "button": { "label": "お問い合わせ", "href": "/contact" } }
      ]
    },
    { "path": "/service", "title": "サービス", "sections": [ { "type": "text", "heading": "サービス内容", "body": "ご要望を伺い、**最適なプラン**をご提案します。\n\n- ロゴ制作\n- Web サイト制作\n- 印刷物デザイン" } ] },
    { "path": "/contact", "title": "お問い合わせ", "description": "お問い合わせはこちらから。", "sections": [ { "type": "form", "heading": "お問い合わせ", "body": "2 営業日以内にご返信します。", "fields": [ { "name": "name", "label": "お名前", "type": "text", "required": true }, { "name": "email", "label": "メールアドレス", "type": "email", "required": true }, { "name": "kind", "label": "ご用件", "type": "select", "options": ["ロゴ制作", "Web 制作", "その他"] }, { "name": "message", "label": "お問い合わせ内容", "type": "textarea", "required": true } ], "submitLabel": "送信する", "successMessage": "送信しました。ご連絡ありがとうございます。" } ] }
  ]
}
```
