pattex / jekyll-tagging

Jekyll plugin to automatically generate a tag cloud and tag pages.
385 stars 76 forks source link

NoMethodError when trying the example from the Readme #8

Closed matthiasbeyer closed 11 years ago

matthiasbeyer commented 11 years ago

My plugins/ext.rb:

~/blog$ cat plugins/ext.rb 
require 'jekyll/tagging

The part in the _config.yml:

~/blog$ cat _config.yml | grep tag
tag_page_layout: tag_page
tag_page_tag: tag

My tag site:

~/blog$ cat source/tags.html 

---
layout: page
title: "tags"
date: 2012-11-29 12:35
comments: true
sharing: true
footer: true

---

<h2>{{ page.tag }}</h2>
<ul>
{% for post in page.posts %}
  <li><a href="{{ post.url }}">{{ post.title }}</a> ({{ post.date | date_to_string }} | Tags: {{ post | tags }})</li>
{% endfor %}
</ul>

<div id="tag-cloud">
  {{ site | tag_cloud }}
</div>

The error:

/home/matthias/.gem/ruby/1.9.1/gems/jekyll-tagging-0.4.0/lib/jekyll/tagging.rb:41:in `block in new_tag': undefined method `ext' for nil:NilClass (NoMethodError)
        from /home/matthias/.gem/ruby/1.9.1/gems/jekyll-tagging-0.4.0/lib/jekyll/tagging.rb:33:in `each'
        from /home/matthias/.gem/ruby/1.9.1/gems/jekyll-tagging-0.4.0/lib/jekyll/tagging.rb:33:in `new_tag'
        from /home/matthias/.gem/ruby/1.9.1/gems/jekyll-tagging-0.4.0/lib/jekyll/tagging.rb:29:in `block in generate_tag_pages'
        from /home/matthias/.gem/ruby/1.9.1/gems/jekyll-tagging-0.4.0/lib/jekyll/tagging.rb:29:in `each'
        from /home/matthias/.gem/ruby/1.9.1/gems/jekyll-tagging-0.4.0/lib/jekyll/tagging.rb:29:in `generate_tag_pages'
        from /home/matthias/.gem/ruby/1.9.1/gems/jekyll-tagging-0.4.0/lib/jekyll/tagging.rb:19:in `generate'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:184:in `block in generate'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:183:in `each'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:183:in `generate'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/lib/jekyll/site.rb:39:in `process'
        from /usr/lib/ruby/gems/1.9.1/gems/jekyll-0.11.2/bin/jekyll:250:in `<top (required)>'
        from /usr/bin/jekyll:19:in `load'
        from /usr/bin/jekyll:19:in `<main>'
blackwinter commented 11 years ago

you specified tag_page as tag_page_layout, so do you have that layout? you may wanna move source/tags.html to _includes/tag_page.html. also, what's tag_page_tag? you probably meant tag_page_dir.

matthiasbeyer commented 11 years ago

I fixed what you said. The error is still occuring. tag_page_dir is the directory where the tag pages are stored, right? I also set layout: tag_page in the file source/_includes/tag_page.html.

blackwinter commented 11 years ago

oops, stupid me!! i meant _layouts not _includes. sorry!

matthiasbeyer commented 11 years ago

Of course, now it's working. But it takes soooo long to generate (300+ Posts in the Blog). Anyway, it's working now! Thank you a lot!

This Issue can be closed now.

wsmoak commented 9 years ago

I ran into this as well. I imagine some other people new to jekyll have also tried and failed at it ... I'll patch the README to make it clear what goes where.

nhoizey commented 9 years ago

I also got the undefined methodext' for nil:NilClass (NoMethodError)error, because I had theatom-tag.xmlin the root directory (as myatom.xml) but it should be in_layouts/`

Toiya commented 6 years ago

Hi! I'm also having this issue, but I can't figure out what's wrong. My _plugins/ext.rb:

require 'jekyll/tagging'

_config.yml:

plugins:
  - jekyll/tagging

# Jekyll-tagging plugin  
tag_page_layout: tag_page
tag_page_dir: tag
tag_permalink_style: pretty

Gemfile:

# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.6"
end

gem 'jekyll-tagging'

tag-page.html is in _layouts folder, and the error message is:

jekyll 3.8.4 | Error:  undefined method `ext' for nil:NilClass

Thank you so much in advance!

HibikeQuantum commented 2 years ago
.rbenv/versions/2.6.10/lib/ruby/gems/2.6.0/gems/jekyll-tagging-1.1.0/lib/jekyll/tagging.rb:61:in `block in new_tag': undefined method `ext' for nil:NilClass (NoMethodError)

In My case, After making _includes/tag_page.html Then the error message disappeared.