diff options
| -rw-r--r-- | src/components/ScheduleInteractive.astro | 5 | ||||
| -rw-r--r-- | src/components/ScheduleSeo.astro | 5 | ||||
| -rw-r--r-- | src/content/docs/kodaira-data/hp-archive/schedule.mdx | 1 | ||||
| -rw-r--r-- | src/data/schedule/config.ts | 14 |
4 files changed, 23 insertions, 2 deletions
diff --git a/src/components/ScheduleInteractive.astro b/src/components/ScheduleInteractive.astro index 5f33c8f..8c14f38 100644 --- a/src/components/ScheduleInteractive.astro +++ b/src/components/ScheduleInteractive.astro @@ -1,4 +1,7 @@ <script> + // URLは src/data/schedule/config.ts で一元管理している(ページ移転時はそこだけ変える) + import { scheduleAbsoluteUrl } from '@/data/schedule/config'; + const CATEGORY_DEFS = [ { icon: '👶', label: '子育て' }, { icon: '🧓', label: '高齢者・介護' }, @@ -601,7 +604,7 @@ }, }, description: e.time, - url: `https://yasutakeyohei.com/kodaira-data/hp-archive/schedule/#${e.rowId}`, + url: scheduleAbsoluteUrl(`#${e.rowId}`), }; }) .sort((a, b) => a.startDate.localeCompare(b.startDate)) diff --git a/src/components/ScheduleSeo.astro b/src/components/ScheduleSeo.astro index 55668f6..03bf268 100644 --- a/src/components/ScheduleSeo.astro +++ b/src/components/ScheduleSeo.astro @@ -1,6 +1,9 @@ --- // このページの構造化データ(JSON-LD)。ビルド日を更新日として出力する。 -const url = 'https://yasutakeyohei.com/kodaira-data/hp-archive/schedule/'; +import { scheduleAbsoluteUrl } from '@/data/schedule/config'; + +// URLは src/data/schedule/config.ts で一元管理している(ページ移転時はそこだけ変える) +const url = scheduleAbsoluteUrl(); const updated = new Date(); const iso = updated.toISOString().slice(0, 10); const label = `${updated.getFullYear()}年${updated.getMonth() + 1}月${updated.getDate()}日`; diff --git a/src/content/docs/kodaira-data/hp-archive/schedule.mdx b/src/content/docs/kodaira-data/hp-archive/schedule.mdx index ac8ccdc..a8ee2b2 100644 --- a/src/content/docs/kodaira-data/hp-archive/schedule.mdx +++ b/src/content/docs/kodaira-data/hp-archive/schedule.mdx @@ -9,6 +9,7 @@ import ScheduleMap from '../../../../components/ScheduleMap.astro'; import ScheduleSeo from '../../../../components/ScheduleSeo.astro'; import ScheduleTable from '../../../../components/ScheduleTable.astro'; +{/* 暫定: hp-archive 配下にある間だけ必要な戻りリンク。独立ページにするときに、この行を削除する。 */} [← 案内ページ(小平市ホームページのアーカイブ(暫定)等)に戻る](/kodaira-data/hp-archive/) <ScheduleSeo /> diff --git a/src/data/schedule/config.ts b/src/data/schedule/config.ts new file mode 100644 index 0000000..3399374 --- /dev/null +++ b/src/data/schedule/config.ts @@ -0,0 +1,14 @@ +// 行事予定ページの公開URLとサイトURL。 +// +// ★ 将来 hp-archive の外へ独立させる(例: /kodaira-data/events/)ときは、 +// この BASE_PATH と、ページファイルの置き場所(src/content/docs/...)だけを変えればよい。 +// ページ内のリンク・canonical・構造化データ・イベントのURLは、ここを参照している。 +export const SITE_URL = 'https://yasutakeyohei.com'; + +export const SCHEDULE_BASE_PATH = '/kodaira-data/hp-archive/schedule/'; + +/** ページ内リンク用(例: scheduleUrl('#event-row-3')) */ +export const scheduleUrl = (suffix = '') => `${SCHEDULE_BASE_PATH}${suffix}`; + +/** 構造化データ・OGP用の絶対URL */ +export const scheduleAbsoluteUrl = (suffix = '') => `${SITE_URL}${scheduleUrl(suffix)}`; |
