Skip to content

Commit d20e953

Browse files
committed
Define the URL for HTTPS and set the host in Sitemap generation
1 parent e4e6056 commit d20e953

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

app/workers/sitemap_refresh_worker.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class SitemapRefreshWorker
44
sidekiq_options queue: :sitemap_generator
55

66
def perform
7+
# ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
78
SitemapGenerator::Sitemap.default_host = 'https://coderwall.com'
89
SitemapGenerator::Sitemap.public_path = 'tmp/'
910
SitemapGenerator::Sitemap.sitemaps_host = "http://#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com/"
@@ -22,22 +23,22 @@ def perform
2223
add('https://coderwall.com/employers', priority: 0.7, changefreq: 'monthly')
2324

2425
Protip.find_each(batch_size: 30) do |protip|
25-
add(protip_url(protip), lastmod: protip.updated_at, priority: 1.0)
26+
add(protip_url(protip, host: 'coderwall.com', protocol: 'https'), lastmod: protip.updated_at, priority: 1.0)
2627
end
2728

2829
Team.all.each do |team|
29-
add(teamname_url(slug: team.slug), lastmod: team.updated_at, priority: 0.9)
30+
add(teamname_url(slug: team.slug, host: 'coderwall.com', protocol: 'https'), lastmod: team.updated_at, priority: 0.9)
3031
team.jobs.each do |job|
31-
add(job_url(slug: team.slug, job_id: job.public_id), lastmod: job.updated_at, priority: 1.0)
32+
add(job_url(slug: team.slug, job_id: job.public_id, host: 'coderwall.com', protocol: 'https'), lastmod: job.updated_at, priority: 1.0)
3233
end
3334
end
3435

3536
User.find_each(batch_size: 30) do |user|
36-
add(badge_url(user.username), lastmod: user.updated_at, priority: 0.9)
37+
add(badge_url(user.username, host: 'coderwall.com', protocol: 'https'), lastmod: user.updated_at, priority: 0.9)
3738
end
3839

3940
BlogPost.all_public.each do |blog_post|
40-
add(blog_post_url(blog_post.id), lastmod: blog_post.posted, priority: 0.5)
41+
add(blog_post_url(blog_post.id, host: 'coderwall.com', protocol: 'https'), lastmod: blog_post.posted, priority: 0.5)
4142
end
4243
end
4344

0 commit comments

Comments
 (0)