middleman / middleman-blog

Blog Engine Extension for Middleman
https://middlemanapp.com
MIT License
326 stars 179 forks source link

Crash when using subdirectories in blog sources directory #196

Closed SachaG closed 10 years ago

SachaG commented 10 years ago

Middleman crashes if I put any blog posts in a subdirectory. Seems to be a problem with generating the slug?

/Users/sacha/.rvm/gems/ruby-2.0.0-p353/gems/middleman-blog-3.5.1/lib/middleman-blog/blog_article.rb:236:in `path_part': undefined method `[]' for nil:NilClass (NoMethodError)
    from /Users/sacha/.rvm/gems/ruby-2.0.0-p353/gems/middleman-blog-3.5.1/lib/middleman-blog/blog_article.rb:201:in `slug'
    from /Users/sacha/.rvm/gems/ruby-2.0.0-p353/gems/middleman-blog-3.5.1/lib/middleman-blog/blog_data.rb:149:in `permalink_options'
    from /Users/sacha/.rvm/gems/ruby-2.0.0-p353/gems/middleman-blog-3.5.1/lib/middleman-blog/blog_data.rb:167:in `template_path'
    from /Users/sacha/.rvm/gems/ruby-2.0.0-p353/gems/middleman-blog-3.5.1/lib/middleman-blog/blog_data.rb:91:in `block in manipulate_resource_list'
    from /Users/sacha/.rvm/gems/ruby-2.0.0-p353/gems/middleman-blog-3.5.1/lib/middleman-blog/blog_data.rb:80:in `each'
...
tdreyno commented 10 years ago

Can you post your directory structure and your config.rb?

SachaG commented 10 years ago

Sorry for the delay. Here's a screenshot of my directory structure: http://cl.ly/Tket

And here's my config.rb: https://gist.github.com/SachaG/c3248933cca3598f5ed7

bhollis commented 10 years ago

When you say "if I put any blog posts in a subdirectory" do you mean the blog post is in a subdirectory of /blog? Seeing your full directory structure would be really helpful (especially what's in /blog). Perhaps just run find . from your source directory and post it into that gist.

bhollis commented 10 years ago

Even better would be if you could post a minimal middleman project that shows the problem. That'd make it really easy to fix.

SachaG commented 10 years ago

Good idea, here you go :)

https://github.com/SachaG/middleman-blog-bug

bhollis commented 10 years ago

Fixed in master.