From 898b52edcb47bcb3e9d6106e74ca73e74ea01e70 Mon Sep 17 00:00:00 2001 From: sillylaird Date: Thu, 3 Sep 2026 00:33:59 +0000 Subject: import live www.sillylaird.ca webroot --- partials/head_meta.php | 103 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 partials/head_meta.php (limited to 'partials/head_meta.php') diff --git a/partials/head_meta.php b/partials/head_meta.php new file mode 100644 index 0000000..4f1bbd4 --- /dev/null +++ b/partials/head_meta.php @@ -0,0 +1,103 @@ + 'en'|'ja'|'zh', // current locale +// 'title' => 'Page title', // og/twitter title +// 'desc' => 'Page description', // og/twitter description +// 'base' => 'Laird_Lonergan_profile', // filename without lang suffix or .php +// 'image' => 'https://www.sillylaird.ca/...', // optional, default og-default.png +// 'image_alt' => 'alt text for the OG image', // optional +// 'image_width' => 1200, 'image_height' => 630, // optional, override defaults +// 'twitter_desc' => '...', // optional, defaults to $desc +// 'type' => 'website'|'article'|'profile', // optional, default website +// 'author' => 'Laird Lonergan', // optional, for articles +// 'published' => '2026-05-26', // optional ISO date for articles +// 'updated' => '2026-05-26', // optional ISO date +// 'og_url' => 'https://www.sillylaird.ca/', // optional; defaults to self_url +// ] + +$_lang = $meta['lang'] ?? 'en'; +$_title = $meta['title'] ?? ''; +$_desc = $meta['desc'] ?? ''; +$_base = $meta['base'] ?? 'index'; +$_image = $meta['image'] ?? 'https://www.sillylaird.ca/assets/img/og-default.png'; +$_imgW = (int)($meta['image_width'] ?? 1200); +$_imgH = (int)($meta['image_height'] ?? 630); +$_imgAlt = $meta['image_alt'] ?? ($_title !== '' ? $_title : 'SillyLaird'); +$_twDesc = $meta['twitter_desc'] ?? $_desc; +$_type = $meta['type'] ?? 'website'; +$_author = $meta['author'] ?? ''; +$_published= $meta['published'] ?? ''; +$_updated = $meta['updated'] ?? ''; + +$_suffix = ['en' => '', 'ja' => '_jp', 'zh' => '_zh'][$_lang] ?? ''; +$_self = '/' . $_base . $_suffix . '.php'; +// URL overrides let pages with non-default canonicals (e.g. the homepage, +// whose EN canonical is the root "/" not "/index.php") reuse this partial. +$_selfUrl = $meta['self_url'] ?? ('https://www.sillylaird.ca' . $_self); +$_ogUrl = $meta['og_url'] ?? $_selfUrl; +$_enUrl = $meta['en_url'] ?? ('https://www.sillylaird.ca/' . $_base . '.php'); +$_jaUrl = $meta['ja_url'] ?? ('https://www.sillylaird.ca/' . $_base . '_jp.php'); +$_zhUrl = $meta['zh_url'] ?? ('https://www.sillylaird.ca/' . $_base . '_zh.php'); +$_xDefault = $meta['x_default'] ?? $_enUrl; +$_ogLocale = ['en' => 'en_US', 'ja' => 'ja_JP', 'zh' => 'zh_CN'][$_lang]; + +$_h = fn(string $s) => htmlspecialchars($s, ENT_QUOTES, 'UTF-8'); +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3