Liquid Exception: undefined method `[]' for nil in sitemap.xml


Hi, I’m new to Jekyll and Ruby, and I’ve been tasked with redesigning the homepage of my company’s website. However, when I run the command jekyll serve, I get the following error:

Configuration file: D:/Projects/Web/cottonwood/_config.yml
Source: D:/Projects/Web/cottonwood
Destination: D:/Projects/Web/cottonwood/_site
Incremental build: disabled. Enable with --incremental
Generating...
Pagination: Pagination is enabled, but I couldn't find an index.html page to use as the pagination template. Skipping pagination.
Jekyll Feed: Generating feed for posts
Liquid Exception: undefined method `[]' for nil in sitemap.xml
                    ------------------------------------------------
Jekyll 4.3.4   Please append `--trace` to the `serve` command 
                 for any additional information or backtrace. 
                    ------------------------------------------------
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-last-modified-at-1.3.2/lib/jekyll-last-modified-at/determinator.rb:38:in `last_modified_at_unix': undefined method `[]' for nil (NoMethodError)

Additional Context:

  • I’m using Jekyll version 4.3.4, and Ruby version 3.3.0.
  • The error is caused by the jekyll-last-modified-at plugin (version 1.3.2), specifically within the determinator.rb file. It seems like the plugin is attempting to access a value in a nil object, leading to the NoMethodError exception.
  • I’ve also encountered a warning about pagination being enabled but not finding the index.html page, which might be related to the issue.

I’ve tried running with --trace for more details, but the issue persists. Has anyone encountered this problem before? Any help would be appreciated!


is this an existing site you are trying to edit or a new site you put together?

have you looked at the sitemap.xml file to see what it is doing? maybe try removing it to see if you can then build the site successfully?

Do you have any posts? I think the error may be saying that it can’t get the date off something that doesn’t exist.