Class: Alula::Sitemap
- Defined in:
- lib/alula/generators/sitemap.rb
Instance Attribute Summary
Attributes inherited from Generator
Instance Method Summary collapse
Methods inherited from Generator
#generators, generators, #initialize, load, register, #substitutes
Constructor Details
This class inherits a constructor from Alula::Generator
Instance Method Details
#allow_compressing? ⇒ Boolean
5 6 7 |
# File 'lib/alula/generators/sitemap.rb', line 5 def allow_compressing? return :normal end |
#generate ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/alula/generators/sitemap.rb', line 9 def generate urls_callback = ->(context) { (context.site.content.posts + context.site.content.pages) .reject {|content| content.generator == self } .reject {|content| content..sitemap == false } .collect { |content| content.languages.collect{|lang| { url: content.url(lang), lastmod: content.last_modified, priority: content.generator.nil? ? 1.0 : !content..priority.nil? ? content..priority : 0.3, } } }.flatten } @sitemap_page = Alula::Content::Page.new({ generator: self, urls: urls_callback, title: "Sitemap", name: "sitemap.xml", slug: "sitemap", sidebar: false, template: self..template || "/:locale/:name", site: self.site, layout: "sitemap", }) self.site.content.pages << @sitemap_page end |