Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `content' #26

Closed
dmalan opened this issue Oct 23, 2017 · 4 comments
Closed

NoMethodError: undefined method `content' #26

dmalan opened this issue Oct 23, 2017 · 4 comments

Comments

@dmalan
Copy link

dmalan commented Oct 23, 2017

Just wanted to report what seems to be a bug when there's an .md file in a collection that doesn't have Jekyll front matter? For instance, if bad.md is in a project's root, it ends up in _site as bad.md, unrendered as expected. But if bad.md is instead in _pages, which we've defined as a collection, the build instead errs, per the below.

Sample files at https://gist.github.com/dmalan/0c67667065cfea19a00fc2ec1f83560a. Do just let me know if anything more would be helpful!

this succeeds

$ find .
.
./_config.yml
./_pages
./_pages/good.md
./bad.md
./Gemfile

$bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Using public_suffix 3.0.0
Using bundler 1.15.4
Using colorator 1.1.0
Using ffi 1.9.18
Using forwardable-extended 2.6.0
Using rb-fsevent 0.10.2
Using kramdown 1.15.0
Using liquid 4.0.0
Using mercenary 0.3.6
Fetching rouge 2.2.1
Installing rouge 2.2.1
Using safe_yaml 1.0.4
Using addressable 2.5.2
Using rb-inotify 0.9.10
Fetching pathutil 0.16.0
Installing pathutil 0.16.0
Using sass-listen 4.0.0
Using listen 3.0.8
Fetching sass 3.5.2
Installing sass 3.5.2
Using jekyll-watch 1.5.0
Using jekyll-sass-converter 1.5.0
Fetching jekyll 3.6.2
Installing jekyll 3.6.2
Fetching jekyll-titles-from-headings 0.5.0
Installing jekyll-titles-from-headings 0.5.0
Bundle complete! 2 Gemfile dependencies, 21 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

$ bundle exec jekyll build -V --trace
  Logging at level: debug
Configuration file: /home/ubuntu/workspace/_config.yml
         Requiring: kramdown
            Source: /home/ubuntu/workspace
       Destination: /home/ubuntu/workspace/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
       EntryFilter: excluded /Gemfile
       EntryFilter: excluded /Gemfile.lock
           Reading: _pages/good.md
         Requiring: kramdown
        Generating: JekyllTitlesFromHeadings::Generator finished in 0.008745871 seconds.
         Rendering: _pages/good.md
  Pre-Render Hooks: _pages/good.md
  Rendering Liquid: _pages/good.md
  Rendering Markup: _pages/good.md
  Rendering Layout: _pages/good.md
                    done in 0.067 seconds.
 Auto-regeneration: disabled. Use --watch to enable.

this fails

$ find .
.
./_config.yml
./_pages
./_pages/bad.md
./_pages/good.md
./Gemfile

$bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Using public_suffix 3.0.0
Using bundler 1.15.4
Using colorator 1.1.0
Using ffi 1.9.18
Using forwardable-extended 2.6.0
Using rb-fsevent 0.10.2
Using kramdown 1.15.0
Using liquid 4.0.0
Using mercenary 0.3.6
Fetching rouge 2.2.1
Installing rouge 2.2.1
Using safe_yaml 1.0.4
Using addressable 2.5.2
Using rb-inotify 0.9.10
Fetching pathutil 0.16.0
Installing pathutil 0.16.0
Using sass-listen 4.0.0
Using listen 3.0.8
Fetching sass 3.5.2
Installing sass 3.5.2
Using jekyll-watch 1.5.0
Using jekyll-sass-converter 1.5.0
Fetching jekyll 3.6.2
Installing jekyll 3.6.2
Fetching jekyll-titles-from-headings 0.5.0
Installing jekyll-titles-from-headings 0.5.0
Bundle complete! 2 Gemfile dependencies, 21 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

$ bundle exec jekyll build -V --trace
  Logging at level: debug
Configuration file: /home/ubuntu/workspace/_config.yml
         Requiring: kramdown
            Source: /home/ubuntu/workspace
       Destination: /home/ubuntu/workspace/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
       EntryFilter: excluded /Gemfile
       EntryFilter: excluded /Gemfile.lock
           Reading: _pages/good.md
         Requiring: kramdown
bundler: failed to load command: jekyll (/opt/rbenv/versions/2.4.0/bin/jekyll)
NoMethodError: undefined method `content' for #<Jekyll::StaticFile:0x005644948e9048>
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-titles-from-headings-0.5.0/lib/jekyll-titles-from-headings/generator.rb:67:in `title_for'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-titles-from-headings-0.5.0/lib/jekyll-titles-from-headings/generator.rb:44:in `block in generate'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-titles-from-headings-0.5.0/lib/jekyll-titles-from-headings/generator.rb:42:in `each'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-titles-from-headings-0.5.0/lib/jekyll-titles-from-headings/generator.rb:42:in `generate'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/site.rb:176:in `block in generate'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/site.rb:174:in `each'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/site.rb:174:in `generate'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/site.rb:72:in `process'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/command.rb:28:in `process_site'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/commands/build.rb:65:in `build'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/commands/build.rb:36:in `process'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/exe/jekyll:15:in `<top (required)>'
  /opt/rbenv/versions/2.4.0/bin/jekyll:22:in `load'
  /opt/rbenv/versions/2.4.0/bin/jekyll:22:in `<top (required)>'
@qwtel
Copy link
Collaborator

qwtel commented Oct 28, 2017

I think this is similar to benbalter/jekyll-relative-links#33. I'll look into it

@dmalan
Copy link
Author

dmalan commented Oct 28, 2017

Thank you kindly!

@dmalan
Copy link
Author

dmalan commented Oct 30, 2017

Thanks, @benbalter!

@ketozhang
Copy link

Running into this issue as well. benbalter/jekyll-relative-links#33 doesn't really help since the solution was to just add Front Matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants