Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent homepage with locale in path to be duplicated #3298

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/app/views/refinery/sitemap/index.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
::I18n.locale = locale

::Refinery::Page.live.in_menu.each do |page|

# exclude sites that are external to our own domain.
if page.url.is_a?(Hash)

Expand All @@ -17,7 +17,7 @@ xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
# handle relative link_url addresses.
raw_url = [request.protocol, request.host_with_port, page.url].join

if (@locales.size > 1) && !page.url.start_with?("/#{locale}/") && defined?(RoutingFilter::RefineryLocales)
if (@locales.size > 1) && !page.url.start_with?("/#{locale}") && !!defined?(RoutingFilter::RefineryLocales)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does the !! add here?

filter = RoutingFilter::RefineryLocales.new
filter.around_generate({}) do
raw_url
Expand All @@ -36,4 +36,4 @@ xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
end if page_url.present?
end
end
end
end