From 5ef13e5aa5ea565b07441616ab1eece565aa2f53 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Thu, 30 Jul 2026 12:55:27 +0200 Subject: Canonicalise per locale and declare hreflang alternates German content is reachable at both /updates/foo and /de/updates/foo, and a page with no English translation renders German at /en/updates/foo through the fallback chain, so three URLs each claimed to be canonical. Both tags now derive from one locale-to-URL function, which points every duplicate at the address of the version actually served, the unprefixed German URL, matching default_url_options. Alternates are declared only for locales in which the page genuinely has a translation, since /en/ serving German through the fallback is not an English version of the page. x-default points at German, the site's primary language. --- app/views/layouts/_social_meta.html.erb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/views') diff --git a/app/views/layouts/_social_meta.html.erb b/app/views/layouts/_social_meta.html.erb index 9a86d26d..36547d26 100644 --- a/app/views/layouts/_social_meta.html.erb +++ b/app/views/layouts/_social_meta.html.erb @@ -23,6 +23,13 @@ <% end %> + <% if (hreflang_alternates = og_hreflang_alternates).any? %> + <% hreflang_alternates.each do |code, url| %> + + <% end %> + + <% end %> + <% if og_published_time %> <% end %> -- cgit v1.3