Skip to content

Commit 8dd098e

Browse files
Move sitemap routes to different URLs
1 parent 2f60561 commit 8dd098e

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

app/controllers/sitemap_controller.rb

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
class SitemapController < ApplicationController
2+
layout false
3+
24
STATIC_PATHS = %w[
35
about
46
arts/submission-guidelines
@@ -22,7 +24,14 @@ class SitemapController < ApplicationController
2224
%w[czech deutsch polski slovenscina slovensko]
2325
].flatten.freeze
2426

25-
def show
27+
before_action :set_all_data
28+
29+
def sitemap_xml; end
30+
def sitemap_text; end
31+
32+
private
33+
34+
def set_all_data
2635
set_latest_article
2736
set_last_modified
2837

@@ -87,8 +96,6 @@ def show
8796
set_episodes_last_modified
8897
end
8998

90-
private
91-
9299
def set_latest_article
93100
@latest_article = Article.published.english.first
94101
end
File renamed without changes.
File renamed without changes.

config/routes.rb

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
require 'sidekiq/web'
22

33
Rails.application.routes.draw do
4-
if Rails.env.local?
5-
# sitemaps
6-
# xml: for robots/search engines
7-
# txt: for humans/archivers
8-
get 'sitemap.xml', to: 'sitemap#show', defaults: { format: 'xml' }, as: :sitemap
9-
get 'sitemap.txt', to: 'sitemap#show', defaults: { format: 'txt' }, as: :sitemap_txt
10-
end
4+
# sitemaps
5+
# xml: for robots/search engines
6+
# txt: for humans/archivers
7+
get 'sitemap_xml', to: 'sitemap#sitemap_xml', defaults: { format: 'xml' }, as: :sitemap_xml
8+
get 'sitemap_txt', to: 'sitemap#sitemap_txt', defaults: { format: 'txt' }, as: :sitemap_txt
119

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

0 commit comments

Comments
 (0)