From 9aa99e27540fa4e6559cdc8bb3b340a1a3742891 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 11 Apr 2023 12:09:13 -0300 Subject: [PATCH] feat: establecer los metadatos para cambiar el idioma #12925 --- app/views/layouts/_link_rel_alternate.haml | 7 +++++++ app/views/layouts/application.html.haml | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 app/views/layouts/_link_rel_alternate.haml diff --git a/app/views/layouts/_link_rel_alternate.haml b/app/views/layouts/_link_rel_alternate.haml new file mode 100644 index 00000000..64a70977 --- /dev/null +++ b/app/views/layouts/_link_rel_alternate.haml @@ -0,0 +1,7 @@ +- unless current_usuarie + - params.permit! + - I18n.available_locales.each do |locale| + - url = url_for(**params.to_h.merge(change_locale_to: locale), only_path: false) + - if locale == I18n.default_locale + %link{ rel: 'alternate', hreflang: 'x-default', href: url } + %link{ rel: 'alternate', hreflang: locale, href: url } diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 965a856f..d2113398 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -4,7 +4,7 @@ %meta{ charset: 'UTF-8' }/ %meta{ content: 'text/html; charset=UTF-8', 'http-equiv': 'Content-Type' }/ - %meta{ name: 'color-scheme', content: 'light dark' }/ + %meta{ name: 'color-scheme', content: 'light' }/ %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1.0' }/ %meta{ name: 'referrer', content: 'same-origin' }/ @@ -17,6 +17,7 @@ = javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' = stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' = favicon_link_tag 'sutty_cuadrada.png', rel: 'apple-touch-icon', type: 'image/png' + = render 'layouts/link_rel_alternate' %body{ class: yield(:body) } .container-fluid#sutty