Skip to content

Commit eb33cd7

Browse files
committed
fix: Override the default generate on the Jekyll sitemap generator to exclude the robots.txt
1 parent eb852bf commit eb33cd7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

_plugins/sitemap_generator.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
require 'jekyll-sitemap'
22

33
module Jekyll
4-
5-
#override the method from the original Jekyll-sitemap gem so it always uses our template instead of using their built-in template
6-
class JekyllSitemap < Jekyll::Generator
4+
class JekyllSitemap < Jekyll::Generator
5+
def generate(site)
6+
@site = site
7+
@site.pages << sitemap unless file_exists?("sitemap.xml")
8+
end
9+
10+
#override the method from the original Jekyll-sitemap gem so it always uses our template instead of using their built-in template
711
def source_path
812
File.expand_path('sitemap.xml', File.dirname(__FILE__))
913
end

0 commit comments

Comments
 (0)