From 6fa3c042b12da46ef0198776dd36dd1d523aa8f4 Mon Sep 17 00:00:00 2001 From: Christian Visintin Date: Sun, 7 Jun 2026 21:40:03 +0200 Subject: [PATCH] feat(site): x-default hreflang, twitter card, og:image:alt; dedupe locales/site in base layout --- site/src/layouts/Base.astro | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/site/src/layouts/Base.astro b/site/src/layouts/Base.astro index 0840c02..9fd8ea7 100644 --- a/site/src/layouts/Base.astro +++ b/site/src/layouts/Base.astro @@ -1,6 +1,6 @@ --- import "../styles/theme.css"; -import { defaultLocale, type Locale } from "../i18n/ui"; +import { defaultLocale, locales, type Locale } from "../i18n/ui"; interface Props { title: string; @@ -11,11 +11,10 @@ interface Props { } const { title, description, locale = defaultLocale, path } = Astro.props; -const site = "https://termscp.rs"; +const site = Astro.site?.href ?? "https://termscp.rs/"; const localizedPath = locale === defaultLocale ? path : `/${locale}${path}`; const canonical = new URL(localizedPath, site).href; const ogImage = new URL("/assets/images/og_preview.jpg", site).href; -const locales: Locale[] = ["en", "zh-CN", "it", "fr", "es"]; --- @@ -35,6 +34,7 @@ const locales: Locale[] = ["en", "zh-CN", "it", "fr", "es"]; href={new URL(l === defaultLocale ? path : `/${l}${path}`, site).href} /> ))} + @@ -45,6 +45,13 @@ const locales: Locale[] = ["en", "zh-CN", "it", "fr", "es"]; + + + + + + + @@ -54,7 +61,7 @@ const locales: Locale[] = ["en", "zh-CN", "it", "fr", "es"]; - +