Sha256: 5ebe422e187e81eb2739491897b76e895c66063a1120739bb91b5634cb641a2a

Contents?: true

Size: 1.52 KB

Versions: 8

Compression:

Stored size: 1.52 KB

Contents

# :nocov:
##
# SitemapGenerator configuration
#
# To generate a sitemap run 'rake sitemap:refresh'
#
# Run this task at least once/day (depending on the size of the website) to keep sitemap up to date.
# Heroku Scheduler or a cron job can be used to do this.
#
# https://github.com/kjvarga/sitemap_generator#sitemap-configuration
# #

# Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = Rails.application.routes.default_url_options[:host]

# Best to compress (gzip) the sitemap, however some analytics tools require uncompressed
# SitemapGenerator::Sitemap.compress = false

# Remote sitemap storage config - Use this if you're running on a ephemeral filesystem (Heroku)
# SitemapGenerator::Sitemap.sitemaps_host = "https://s3-#{ENV.fetch('AWS_REGION')}.amazonaws.com/#{ENV.fetch('AWS_S3_BUCKET_NAME')}/"
# SitemapGenerator::Sitemap.public_path = 'tmp/'
# SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/'
# SitemapGenerator::Sitemap.adapter = SitemapGenerator::WaveAdapter.new

SitemapGenerator::Sitemap.create do
  # Add page paths, skip path of dynamic homepage
  homepage = Integral::Page.find_by_id(Integral::Settings['homepage_id'])
  Integral::Page.published.find_each do |page|
    add page.path, lastmod: page.updated_at unless page == homepage
  end

  if Integral.blog_enabled?
    integral = Integral::Engine.routes.url_helpers
    add integral.posts_path
    add integral.tags_path

    Integral::Post.published.find_each do |object|
      add integral.post_path(object), lastmod: object.updated_at
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
integral-1.5.1 lib/generators/templates/sitemap.rb
integral-1.5.0 lib/generators/templates/sitemap.rb
integral-1.4.0 lib/generators/templates/sitemap.rb
integral-1.3.0 lib/generators/templates/sitemap.rb
integral-1.2.0 lib/generators/templates/sitemap.rb
integral-1.1.0 lib/generators/templates/sitemap.rb
integral-1.0.1 lib/generators/templates/sitemap.rb
integral-1.0.0 lib/generators/templates/sitemap.rb