Class: Bookbinder::SitemapGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/bookbinder/sitemap_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate(links) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/bookbinder/sitemap_generator.rb', line 5

def generate(links)
  Nokogiri::XML::Builder.new(encoding: 'UTF-8') { |xml|
    xml.urlset('xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9') {
      links.each do |link|
        xml.url {
          xml.loc link
          xml.changefreq 'daily'
        }
      end
    }
  }.to_xml
end