Empty urlset with Jekyll 3.0.1 (using `--source` and `--destination`)
nfagerlund opened this issue · 1 comments
Our sitemap has a urlset element, but it's now empty after upgrading to latest Jekyll and latest sitemap plugin. Jekyll 3.0.1, about a bazillion pages, zero posts. Our site builder runs Jekyll using the --source
and --destination
flags, and does not chdir into the source dir before running it.
Prying things open with byebug, it looks like the problem is here:
def fill_pages(site, urlset)
site.pages.each do |page|
if !excluded?(site, page.path_to_source)
if File.exists?(page.path) # <-- RIGHT HERE
url = fill_url(site, page)
urlset.add_element(url)
end
end
end
end
The value of page.path
is always something like "pe/2015.3/windows_config_mgmnt.md"
, and just calling File.exists?
on it will only work if you've chdired into the source dir.
So I figure, instead of relying on an unreliable pwd, the generator should be prepending the value of site.source
to each page.
And actually, come to think of it, why test for existence in the first place? Is there a situation where Jekyll would create and hold onto a page object without a source file?
Ack, there's other places in the code that make the same assumption. Just found one when I ripped out that check: date = File.mtime(page_or_post.path)
.