Skip to content

Commit 091887c

Browse files
Remove sitemap_generator gem and usage (#4156)
Cleanup following: - #4155 - #4060 # Summary - remove `sitemap_generator` config initializer - remove `sitemap_generator` in `Procfile` and a test - remove `sitemap_generator` gem - make xml/txt formats explicit in the routes (`curl .../sitemap.xml` was getting the `.txt` version mistakenly) - remove duplicate `/tce` URL in both sitemaps
1 parent 594c124 commit 091887c

File tree

8 files changed

+3
-111
lines changed

8 files changed

+3
-111
lines changed

Gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ gem 'puma'
1515
gem 'autoprefixer-rails'
1616
gem 'bootstrap'
1717
gem 'sassc-rails'
18-
gem 'sitemap_generator' # for generating a compliant xml sitemap
1918
gem 'uglifier'
2019

2120
# Javascript / Hotwire

Gemfile.lock

-3
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,6 @@ GEM
472472
simplecov_json_formatter (~> 0.1)
473473
simplecov-html (0.13.1)
474474
simplecov_json_formatter (0.1.4)
475-
sitemap_generator (6.3.0)
476-
builder (~> 3.0)
477475
smart_properties (1.17.0)
478476
sorbet-runtime (0.5.11694)
479477
sprockets (4.2.1)
@@ -584,7 +582,6 @@ DEPENDENCIES
584582
selenium-webdriver
585583
sidekiq (< 8)
586584
simplecov
587-
sitemap_generator
588585
squasher
589586
stackprof
590587
sterile

Procfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
release: bundle exec rake db:migrate sitemap:refresh
1+
release: bundle exec rake db:migrate
22
web: bundle exec puma -C config/puma.rb
33
worker: RAILS_MAX_THREADS=${SIDEKIQ_RAILS_MAX_THREADS} bundle exec sidekiq -q default -q mailers -q active_storage_analysis -q active_storage_purge

app/views/sitemap/show.text.erb

-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
<% end %>
4343
<%# %>
4444
<%# To Change Everything (TCE) %>
45-
<%= to_change_everything_url %>
46-
<%# %>
4745
<% @to_change_everything_languages.each do |tce_language| %>
4846
<%= to_change_everything_url(lang: tce_language) %>
4947
<%= [to_change_everything_url(lang: tce_language), '/get'].join %>

app/views/sitemap/show.xml.erb

-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@
5454
<% end %>
5555

5656
<%# To Change Everything (TCE) %>
57-
<%= render 'sitemap/url', loc: to_change_everything_url, lastmod: @last_modified %>
58-
5957
<% @to_change_everything_languages.each do |tce_language| %>
6058
<%= render 'sitemap/url', loc: to_change_everything_url(lang: tce_language), lastmod: @last_modified %>
6159
<%= render 'sitemap/url', loc: [to_change_everything_url(lang: tce_language), '/get'].join, lastmod: @last_modified %>

config/routes.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# sitemaps
55
# xml: for robots/search engines
66
# txt: for humans/archivers
7-
get 'sitemap.xml', to: 'sitemap#show', as: :sitemap
8-
get 'sitemap.txt', to: 'sitemap#show', as: :sitemap_txt
7+
get 'sitemap.xml', to: 'sitemap#show', defaults: { format: 'xml' }, as: :sitemap
8+
get 'sitemap.txt', to: 'sitemap#show', defaults: { format: 'txt' }, as: :sitemap_txt
99

1010
# TODO: After switching the site auth to Devise, enable this auth protected route
1111
# # Sidekiq admin interface to monitor background jobs

config/sitemap.rb

-95
This file was deleted.

spec/requests/clean_paths_spec.rb

-5
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@
1616
end
1717

1818
it 'does not strip .xml extension from sitemap.xml' do
19-
# TODO: update this test when we remove sitemap_generator gem and scheduled jobs
20-
Rake::Task['sitemap:refresh:no_ping'].invoke
21-
2219
get 'http://example.com/sitemap.xml'
2320

2421
expect(response).to have_http_status(:ok)
2522
expect(response.header['Location']).to be_nil
2623
expect(response.body).not_to be_empty
27-
28-
Rake::Task['sitemap:clean'].invoke
2924
end
3025
end

0 commit comments

Comments
 (0)