diff options
| author | Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com> | 2025-03-14 23:45:58 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <94913521+arielcostas@users.noreply.github.com> | 2025-03-14 23:45:58 +0100 |
| commit | b0eac3d3548c7b9065fe0360dc48e8df6f1f80e2 (patch) | |
| tree | 23e2bb19ba749cf7f1e93f4426f002e1d86fa98f /src/layouts/Layout.astro | |
| parent | e3c4bb2efa513973bc26949a8be62fbe66e31a4f (diff) | |
Add multilingual support to layout and footer; include alternate hreflang links
Diffstat (limited to 'src/layouts/Layout.astro')
| -rw-r--r-- | src/layouts/Layout.astro | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index eda1716..c8d3302 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -3,6 +3,8 @@ import "@fontsource/beiruti"; import "@fontsource-variable/sen"; import Header from "../partials/Header.astro"; import Footer from "../partials/Footer.astro"; +import { getAbsoluteLocaleUrl } from "astro:i18n"; +import { getUrlWithoutLocale } from '../i18n'; interface Props { title: string; @@ -10,6 +12,7 @@ interface Props { } const { title, description } = Astro.props; +const urlWithoutLocale = getUrlWithoutLocale(Astro.url.pathname); --- <!doctype html> @@ -20,6 +23,10 @@ const { title, description } = Astro.props; <meta name="viewport" content="width=device-width" /> <link rel="canonical" href={Astro.url.toString().replace(/\.html$/, '')} /> + <link rel="alternate" hreflang="es" href={getAbsoluteLocaleUrl("es", urlWithoutLocale)} /> + <link rel="alternate" hreflang="en" href={getAbsoluteLocaleUrl("en", urlWithoutLocale)} /> + <link rel="alternate" hreflang="x-default" href={getAbsoluteLocaleUrl("es", urlWithoutLocale)} /> + <link rel="alternate" type="application/rss+xml" href="/blog.xml" /> <link rel="sitemap" type="application/xml" href="/sitemap-index.xml" /> |
