2018-02-05 20:04:37 +03:00
|
|
|
require 'jekyll-sitemap'
|
|
|
|
|
|
|
|
module Jekyll
|
2021-06-18 10:47:38 +03:00
|
|
|
class JekyllSitemap < Jekyll::Generator
|
|
|
|
def generate(site)
|
|
|
|
@site = site
|
|
|
|
@site.pages << sitemap unless file_exists?("sitemap.xml")
|
|
|
|
end
|
|
|
|
|
|
|
|
#override the method from the original Jekyll-sitemap gem so it always uses our template instead of using their built-in template
|
2018-12-11 18:41:00 +03:00
|
|
|
def source_path
|
2021-06-18 10:47:38 +03:00
|
|
|
File.expand_path('sitemap.xml', File.dirname(__FILE__))
|
|
|
|
end
|
|
|
|
end
|
2018-02-05 20:04:37 +03:00
|
|
|
JekyllSitemap.new.source_path
|
|
|
|
|
|
|
|
end
|