First question here and new to Ruby and Jekyll so forgive me if I miss some important details.
I'm trying to use bundle exec jekyll serve
to generate my static site, but I keep getting the following error message:
Liquid Exception: undefined method `fetch' for true:TrueClass in sitemap.xml
Edit: The problem was I had deleted/modified the something in my collections configuration in my _config.yml.
It should have been
collections:
my_collection:
output: true
...but instead was simply
collections:
output: true
Not sure if it was always like that, or if I had modified it somehow. Check your _config.yml!
I have tested the gem without getting any error.
_config.yml
plugins:
- jekyll-sitemap
collections_dir: my_collections
collections:
books:
output: true
Gemfile
source 'https://rubygems.org' do
gem "jekyll"
gem 'jekyll-sitemap'
end
book.md in my_collections\books
---
title: first book
---
first book
Resulting sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://localhost:4000/books/book/</loc>
</url>
<url>
<loc>http://localhost:4000/</loc>
</url>
</urlset>
As said in my comment above I assume that there is a problem in your collection configuration in your _config.yml file. Also, there are some known issues listed on the official plugin page.