diff --git a/docs/404.md b/docs/404.md
new file mode 100644
index 0000000..fce40fc
--- /dev/null
+++ b/docs/404.md
@@ -0,0 +1,21 @@
+---
+# 見つからないURLのときに GitHub Pages が返すページ。1枚だけなので日英を並べて書く。
+# どの階層でも表示されるので base_href で相対リンクをサイトの先頭から解決させ、検索結果には出さない(_includes/seo.html)
+layout: default
+title: ページが見つかりません
+permalink: /404.html
+base_href: true
+lead: お探しのページは移動したか、削除された可能性があります。 The page you are looking for may have been moved or removed.
+---
+
+- [ユーザーガイドのトップ](index.html)(左の目次から目的のページを開けます)
+- [紹介ページ](intro.html)(製造指図から出荷までの流れと主な画面を、画面写真で紹介しています)
+
+
+
+## English
+
+- [User Guide](en/)
+- [Overview of Parallel Factory MES](en/intro.html)
+
+
diff --git a/docs/_config.yml b/docs/_config.yml
index 95073d8..1e9dda1 100644
--- a/docs/_config.yml
+++ b/docs/_config.yml
@@ -9,6 +9,10 @@
# ページ間のリンクはすべて相対リンク(例: getting-started.html)のため、
# baseurl の設定は不要です。テーマは使わず _layouts/default.html を使用します。
+# 公開URL(末尾は /)。canonical・hreflang・OGP・sitemap.xml の完全なURLだけに使う(ページ間のリンクは相対のまま)。
+# フォークして別の場所で公開するときはここを書き換える
+site_url: https://msmsrep.github.io/ParallelFactoryMES/
+
title: Parallel Factory MES ユーザーガイド
description: 製造実績管理システム Parallel Factory MES の操作マニュアル
diff --git a/docs/_data/ui.yml b/docs/_data/ui.yml
index 272f64b..77cf992 100644
--- a/docs/_data/ui.yml
+++ b/docs/_data/ui.yml
@@ -15,6 +15,10 @@ ja:
lang_switch_code: en
ja_only: ""
ja_only_title: ""
+ # SNSで共有したときの画像(_includes/seo.html。site_url からの相対)
+ og_image: assets/og.png
+ og_image_alt: Parallel Factory MES のダッシュボード画面
+ og_locale: ja_JP
en:
site_title: Parallel Factory MES User Guide
site_description: User manual for Parallel Factory MES, a manufacturing execution system
@@ -30,3 +34,6 @@ en:
lang_switch_code: ja
ja_only: JA
ja_only_title: Not yet translated. Opens the Japanese page.
+ og_image: assets/en/og.png
+ og_image_alt: The Parallel Factory MES dashboard screen
+ og_locale: en_US
diff --git a/docs/_includes/seo.html b/docs/_includes/seo.html
new file mode 100644
index 0000000..eb9c75b
--- /dev/null
+++ b/docs/_includes/seo.html
@@ -0,0 +1,45 @@
+{%- comment -%}
+ 検索エンジンとSNS向けの head 要素(canonical・hreflang・OGP・Xカード)。
+ ガイドの共通レイアウトと、レイアウトを使わない独立ページ(intro.html・factory-tour.html とその英語版)の両方から読む。
+ - nav_url の無いページ(404.html)は canonical を出さず noindex にする
+ - 呼び出し側で title を渡す。説明文は page.description、無ければ page.lead
+ - URL は _config.yml の site_url を基点にした完全なURL(Google は hreflang・canonical に完全なURLを求める)
+ - 日英の対応は同じ nav_url を持つページの有無で判定する(docs-dev/GuideEnPlan.md)
+{%- endcomment -%}
+{%- assign seo_lang = page.lang | default: site.lang -%}
+{%- assign seo_ui = site.data.ui[seo_lang] -%}
+{%- if page.nav_url == "index.html" -%}{%- assign seo_path = "" -%}{%- else -%}{%- assign seo_path = page.nav_url -%}{%- endif -%}
+{%- assign seo_ja = site.site_url | append: seo_path -%}
+{%- assign seo_en = site.site_url | append: "en/" | append: seo_path -%}
+{%- if seo_lang == "en" -%}
+ {%- assign seo_url = seo_en -%}
+ {%- assign seo_pair = site.pages | where: "nav_url", page.nav_url | where: "dir", "/" | first -%}
+{%- else -%}
+ {%- assign seo_url = seo_ja -%}
+ {%- assign seo_pair = site.pages | where: "nav_url", page.nav_url | where: "dir", "/en/" | first -%}
+{%- endif -%}
+{%- assign seo_desc = page.description | default: page.lead | default: seo_ui.site_description | markdownify | strip_html | strip_newlines | strip -%}
+
+{%- if page.nav_url %}
+
+{%- else %}
+
+{%- endif %}
+{%- if page.nav_url and seo_pair %}
+
+
+
+{%- endif %}
+
+
+
+
+{%- if page.nav_url %}
+
+{%- endif %}
+
+
+
+
+
+
diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html
index c0317b7..05a5de2 100644
--- a/docs/_layouts/default.html
+++ b/docs/_layouts/default.html
@@ -21,12 +21,16 @@
-{% if page.title and page.nav_url != "index.html" %}{{ page.title }} | {% endif %}{{ ui.site_title }}
-
-
-{%- if switch_url %}
-
+{%- if page.base_href %}
+
+
{%- endif %}
+{%- capture page_title -%}{% if page.title and page.nav_url != "index.html" %}{{ page.title }} | {% endif %}{{ ui.site_title }}{%- endcapture %}
+{{ page_title }}
+{% include seo.html title=page_title %}
+
+
+
{{ ui.skip }}
diff --git a/docs/assets/en/og.png b/docs/assets/en/og.png
new file mode 100644
index 0000000..c3f0496
Binary files /dev/null and b/docs/assets/en/og.png differ
diff --git a/docs/assets/og.png b/docs/assets/og.png
new file mode 100644
index 0000000..3b09216
Binary files /dev/null and b/docs/assets/og.png differ
diff --git a/docs/en/factory-tour.html b/docs/en/factory-tour.html
index 7bc2fa0..6920fee 100644
--- a/docs/en/factory-tour.html
+++ b/docs/en/factory-tour.html
@@ -1,15 +1,16 @@
---
+# Standalone page (no layout). Search and social head tags come from _includes/seo.html
nav_url: factory-tour.html
+seo_title: "Factory model: from production to shipping | Parallel Factory MES User Guide"
+description: "Follow the sample gear-pump production on a moving factory model and see how the MES records change."
---
-Factory model: from production to shipping | Parallel Factory MES User Guide
-
-
-
+{{ page.seo_title }}
+{% include seo.html title=page.seo_title %}
diff --git a/docs/en/intro.html b/docs/en/intro.html
index 6b28439..b136cdf 100644
--- a/docs/en/intro.html
+++ b/docs/en/intro.html
@@ -1,17 +1,30 @@
+---
+# Standalone page (no layout). Search and social head tags come from _includes/seo.html
+nav_url: intro.html
+seo_title: "Parallel Factory MES | Open-source manufacturing execution system (MES)"
+description: "An open-source manufacturing execution system that records and traces production lot by lot, from manufacturing orders to shipping."
+---
-Parallel Factory MES
+{{ page.seo_title }}
+{% include seo.html title=page.seo_title %}
-
-
-
+
diff --git a/docs/factory-tour.html b/docs/factory-tour.html
index b1335dc..510e76d 100644
--- a/docs/factory-tour.html
+++ b/docs/factory-tour.html
@@ -1,15 +1,19 @@
+---
+# 独立ページ(レイアウトなし)。head の検索・SNS向け要素は _includes/seo.html
+nav_url: factory-tour.html
+seo_title: "工場模型で見る 製造から出荷まで | Parallel Factory MES ユーザーガイド"
+description: "サンプルのギアポンプ製造を、動く工場模型と MES の記録の変化で見るページ。"
+---
-工場模型で見る 製造から出荷まで | Parallel Factory MES ユーザーガイド
-
+{{ page.seo_title }}
+{% include seo.html title=page.seo_title %}
-
-
diff --git a/docs/intro.html b/docs/intro.html
index 90ee152..a44f764 100644
--- a/docs/intro.html
+++ b/docs/intro.html
@@ -1,19 +1,32 @@
+---
+# 独立ページ(レイアウトなし)。head の検索・SNS向け要素は _includes/seo.html
+nav_url: intro.html
+seo_title: "Parallel Factory MES|オープンソースの製造実行システム(MES)"
+description: "製造指図から出荷まで、ロット単位で記録・追跡するオープンソースの製造実行システム。"
+---
-Parallel Factory MES
+{{ page.seo_title }}
+{% include seo.html title=page.seo_title %}
-
-
-
+
diff --git a/docs/sitemap.xml b/docs/sitemap.xml
new file mode 100644
index 0000000..730b002
--- /dev/null
+++ b/docs/sitemap.xml
@@ -0,0 +1,31 @@
+---
+# 検索エンジン向けのサイトマップ。nav_url を持つページ(ガイド・紹介・工場模型)を日英の対応つきで並べる。
+# プロジェクトサイトでは robots.txt を置けない(ドメイン直下にしか効かない)ので、Search Console から送る
+layout: null
+---
+
+
+{%- assign ja_pages = site.pages | where: "dir", "/" | where_exp: "p", "p.nav_url" | sort: "nav_url" -%}
+{%- for p in ja_pages -%}
+{%- if p.nav_url == "index.html" -%}{%- assign path = "" -%}{%- else -%}{%- assign path = p.nav_url -%}{%- endif -%}
+{%- assign ja = site.site_url | append: path -%}
+{%- assign en = site.site_url | append: "en/" | append: path -%}
+{%- assign pair = site.pages | where: "dir", "/en/" | where: "nav_url", p.nav_url | first %}
+
+ {{ ja }}
+ {%- if pair %}
+
+
+
+ {%- endif %}
+
+ {%- if pair %}
+
+ {{ en }}
+
+
+
+
+ {%- endif -%}
+{%- endfor %}
+
diff --git a/scripts/GuideEnCheck.ps1 b/scripts/GuideEnCheck.ps1
index efcb07a..de99d0a 100644
--- a/scripts/GuideEnCheck.ps1
+++ b/scripts/GuideEnCheck.ps1
@@ -35,7 +35,8 @@ $jaChars = '[\p{IsHiragana}\p{IsKatakana}\p{IsCJKUnifiedIdeographs}]'
# 対象のページ(Markdown と、レイアウトを使わない独立 HTML)
function Get-Pages([string]$dir) {
if (-not (Test-Path $dir)) { return @() }
- Get-ChildItem $dir -File | Where-Object { $_.Extension -in '.md', '.html' }
+ # 404(404.md)はサイトに1枚だけ置き、日英を並べて書くので対象にしない
+ Get-ChildItem $dir -File | Where-Object { $_.Extension -in '.md', '.html' -and $_.BaseName -ne '404' }
}
function Get-FrontMatter([string]$path) {
$result = @{}