discourse/spec/integrity
Natalie Tay ced7833cd0
FEATURE: Append locale to links in crawler view if present (#34466)
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
2025-08-22 08:46:33 +08:00
..
coding_style_spec.rb Enable Embroider/Webpack code spliting for Wizard (#24919) 2023-12-20 13:15:06 +00:00
common_mark_spec.rb DEV: Modernise highlightjs loading (#24197) 2023-11-10 20:39:48 +00:00
having_multiple_tagged_loggers_spec.rb DEV: Add spec to ensure app works with multiple tagged loggers 2024-08-13 18:10:03 +02:00
i18n_spec.rb DEV: Fix the I18n integrity spec 2024-07-10 11:39:13 +02:00
js_constants_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
middleware_order_spec.rb FEATURE: Append locale to links in crawler view if present (#34466) 2025-08-22 08:46:33 +08:00
oj_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
onceoff_integrity_spec.rb PERF: Avoid using ObjectSpace.each_object in Jobs::Onceoff.enqueue_all (#28072) 2024-07-25 13:30:56 +08:00
site_setting_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00