mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-23 00:24:19 +08:00
This applies the following when `SiteSetting.content_localization_enabled && SiteSetting.content_localization_crawler_param` and in crawler view. - note: `content_localization_crawler_param` is an experimental site setting - attaches the following in crawler view, depending on the values in `SiteSetting.content_localization_supported_locales`, assuming en, ja, ko. ([old](https://developers.google.com/search/blog/2013/04/x-default-hreflang-for-international-pages) but likely relevant) ``` <link rel="alternate" href="https://nat-1.demo-by-discourse.com/" hreflang="x-default"> <link rel="alternate" href="https://nat-1.demo-by-discourse.com/?tl=en" hreflang="en"> <link rel="alternate" href="https://nat-1.demo-by-discourse.com/?tl=ja" hreflang="ja"> <link rel="alternate" href="https://nat-1.demo-by-discourse.com/?tl=ko" hreflang="ko"> ``` - appends the `tl` param based on the presence of it in the incoming request - this method puts every response for crawler requests through Nokogiri parse.. so we'll have to see how this goes in practice ### Video In the following video you can see each page has the code chunk above in `head`, and each navigated page has the appropriate appended URL param. /t/160415
29 lines
1 KiB
Text
Vendored
29 lines
1 KiB
Text
Vendored
<!DOCTYPE html>
|
|
<html lang="<%= html_lang %>">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title><%= title_content %></title>
|
|
<meta name="description" content="<%= description_content %>">
|
|
<%= render partial: "layouts/head" %>
|
|
<%= render partial: "common/hreflang_tags" %>
|
|
<%= render partial: "common/discourse_stylesheet" %>
|
|
<%= theme_lookup("head_tag") %>
|
|
<%= render_google_universal_analytics_code %>
|
|
<%= yield :head %>
|
|
<%= build_plugin_html 'server:before-head-close-crawler' %>
|
|
</head>
|
|
<body class="crawler <% if show_browser_update? %>browser-update<% end %>">
|
|
<%= theme_lookup("header") %>
|
|
<%= render partial: "layouts/noscript_header" %>
|
|
<div id="main-outlet" class="wrap" role="main">
|
|
<%= yield %>
|
|
</div>
|
|
<%= render partial: "layouts/noscript_footer" %>
|
|
<%= theme_lookup("footer") %>
|
|
<%= theme_lookup("body_tag") %>
|
|
<% if show_browser_update? %>
|
|
<div class="buorg"><div><%= I18n.t("js.browser_update").html_safe %></div></div>
|
|
<% end %>
|
|
</body>
|
|
<%= yield :after_body %>
|
|
</html>
|