Q:

Getting an error from jekyll-sitemap plugin: undefined method `fetch' for true:TrueClass in sitemap.xml

first question here 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

I have disabled all plugins, and re-enabled them one by one, and it's clear that this is being caused by the jekyll-sitemap plugin (as is also evident in the error message). 
I try to work around it by simply disabling it, as I don't think I need it for this tiny blog project (correct me if I'm wrong), but if I disable it, none of my {% for %} loops in Liquid seem to work anymore, as only my index.html gets generated. I can't see why this is connected to jekyll-sitemap, but I'm very new to Ruby and to Jekyll. 
Thanks for your time, let me know if there's anything I can clarify!
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!

A:

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.

