Class: Para::SeoTools::Sitemap

Inherits:
Object
  • Object
show all
Defined in:
lib/para/seo_tools/sitemap.rb

Class Method Summary collapse

Class Method Details

.generate!Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/para/seo_tools/sitemap.rb', line 9

def self.generate!
  prepare

  SitemapGenerator::Sitemap.create do
    Para::SeoTools::Page.where(
      "path ~* ? AND CAST(config->>'noindex' AS boolean) != ?",
      Para::SeoTools.sitemap_path_regexp, true
    ).find_each do |page|
      add(page.path, host: page.host) unless page.config['noindex']
    end
  end
end

.ping_search_enginesObject



22
23
24
25
26
# File 'lib/para/seo_tools/sitemap.rb', line 22

def self.ping_search_engines
  prepare

  SitemapGenerator::Sitemap.ping_search_engines
end

.prepareObject



4
5
6
7
# File 'lib/para/seo_tools/sitemap.rb', line 4

def self.prepare
  SitemapGenerator::Sitemap.sitemaps_path = Para::SeoTools.sitemaps_path
  SitemapGenerator::Sitemap.default_host = Para::SeoTools.full_host
end