Sha256: f20cc1a4a666763f468a7f2e6cb9ab3c896837c19a22729adaa80e30b1ec3e40
Contents?: true
Size: 864 Bytes
Versions: 2
Compression:
Stored size: 864 Bytes
Contents
# encoding: utf-8 require 'fileutils' require 'xml-sitemap' require 'easy_html_generator/generator/base' # this generator combines files in the dist folder class EasyHtmlGenerator::Generator::Service::Sitemap < EasyHtmlGenerator::Generator::Base def generate!(config) files = Dir[config.selector] files.map! do |file| file.sub(@project.dist_path, '').sub(@project.name, '') end generate_sitemap(files, config) end def generate_sitemap(files, config) map = XmlSitemap::Map.new(config.domain) do |m| files.each do |file| next if blacklisted?(file, config) m.add file, updated: Date.today, period: :daily end end map.render_to(config.target) end def blacklisted?(file, config) return false if config.blacklist.nil? config.blacklist.any? { |entry| file.include?(entry) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
easy_html_generator-1.0.6 | lib/easy_html_generator/generator/service/sitemap.rb |
easy_html_generator-1.0.5 | lib/easy_html_generator/generator/service/sitemap.rb |