Created
April 18, 2017 22:23
-
-
Save rob-mcgrail/32b2e5e7a36fe10a0a892e4de566f5cc to your computer and use it in GitHub Desktop.
config/sitemap.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the host name for URL creation | |
protocol = ENV['PROTOCOL'] || 'http' | |
SitemapGenerator::Sitemap.default_host = "#{protocol}://#{ENV['HOST']}" | |
SitemapGenerator::Sitemap.compress = false | |
SitemapGenerator::Sitemap.create do | |
add('/topics') | |
add('/concepts') | |
add('/?search=true') | |
Article.published.each do |o| | |
add o.base_uri, :lastmod => o.updated_at | |
end | |
Image.published.each do |o| | |
add o.base_uri, :lastmod => o.updated_at | |
end | |
Video.published.each do |o| | |
add o.base_uri, :lastmod => o.updated_at | |
end | |
Document.published.each do |o| | |
add o.base_uri, :lastmod => o.updated_at | |
end | |
Embed.published.each do |o| | |
add o.base_uri, :lastmod => o.updated_at | |
end | |
self.class.send(:include, TagsHelper) | |
ActsAsTaggableOn::Tag.all.each do |o| | |
if o.taggings.first.try(:context) | |
add tag_path(o, o.taggings.first.context), :lastmod => o.touched_at | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment