Middleman Build Breaks on Unwanted Blog/Index File, Works Fine in Serve

Hi,

New user here. I’ve been developing a static site for use with github-pages and I keep running into an error in which my build fails on Middleman trying to build a “blog/index.html” page-- the project serves fine locally and I don’t even want that file. I’m using the blog plugin but I have the blog prefix turned off. I can’t figure out why its trying to build this file and I can’t seem to nail down a workaround either. Anyone have any bright ideas?

bundle exec middleman build --clean --verbose
== Activating: sprockets
== Reading:  Local config
== Activating: blog
== Activating: directory_indexes
== Activating: livereload
Loaded extensions:
== Extension: sprockets
== Extension: blog
== Extension: directory_indexes
== Extension: livereload
== Extension: frontmatter
== File Change: config.rb
== File Change: deploy.rake
== File Change: Rakefile.rb
== File Change: source/2012-01-01-example-article.html.markdown
== File Change: source/2015-05-27-daredevil-wears-prada.html.markdown
== File Change: source/blog.html.erb
== File Change: source/calendar.html.erb
== File Change: source/CNAME
== File Change: source/feed.xml.builder
== File Change: source/images/background.png
== File Change: source/images/daredevil.jpg
== File Change: source/images/middleman.png
== File Change: source/index.html.erb
== File Change: source/javascripts/all.js
== File Change: source/layout.erb
== File Change: source/layouts/layout.erb
== File Change: source/stylesheets/_site.scss
== File Change: source/stylesheets/all.css
== File Change: source/stylesheets/normalize.css
== File Change: source/stylesheets/rewrite.scss
== File Change: source/tag.html.erb
== Rebuilding resource list
== Prerendering CSS
  identical  build/stylesheets/all.css
  identical  build/stylesheets/normalize.css
     update  build/stylesheets/rewrite.css
== Checking for Compass sprites
== Building files
  identical  build/images/middleman.png
  identical  build/images/background.png
  identical  build/images/daredevil.jpg
  identical  build/fonts/font-awesome/fontawesome-webfont.svg
  identical  build/fonts/font-awesome/fontawesome-webfont.woff
  identical  build/fonts/font-awesome/fontawesome-webfont.woff2
  identical  build/fonts/font-awesome/fontawesome-webfont.ttf
  identical  build/fonts/font-awesome/fontawesome-webfont.eot
  identical  build/javascripts/all.js
== Request: /2012/01/01/example-article/index.html
== Finishing Request: 2012/01/01/example-article/index.html (0.03s)
     update  build/2012/01/01/example-article/index.html
== Request: /index.html
== Finishing Request: index.html (0.03s)
     update  build/index.html
== Request: /feed.xml
== Finishing Request: feed.xml (0.01s)
     update  build/feed.xml
== Request: /CNAME
== Finishing Request: CNAME (0.0s)
  identical  build/CNAME
== Request: /blog/index.html
      error  build/blog/index.html
no implicit conversion of nil into String
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.10/lib/active_support/core_ext/string/output_safety.rb:159:in `concat'
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.10/lib/active_support/core_ext/string/output_safety.rb:159:in `safe_concat'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-more/core_extensions/default_helpers.rb:69:in `capture_html'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/rendering.rb:429:in `wrap_layout'
/dev/rewrite/source/blog.html.erb:1:in `block in singleton class'
/dev/rewrite/source/blog.html.erb:-6:in `instance_eval'
/dev/rewrite/source/blog.html.erb:-6:in `singleton class'
/dev/rewrite/source/blog.html.erb:-8:in `__tilt_70218710066280'
/Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `call'
/Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `evaluate'
/Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/rendering.rb:303:in `render_individual_file'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/rendering.rb:181:in `_render_with_all_renderers'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/rendering.rb:149:in `render_template'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/sitemap/resource.rb:127:in `block in render'
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.10/lib/active_support/notifications.rb:161:in `instrument'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/util.rb:41:in `instrument'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/application.rb:235:in `instrument'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/sitemap/resource.rb:14:in `instrument'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/sitemap/resource.rb:100:in `render'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/request.rb:260:in `process_request'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/request.rb:210:in `block in call!'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/request.rb:209:in `catch'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/request.rb:209:in `call!'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/core_extensions/request.rb:195:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.1/lib/rack/urlmap.rb:66:in `block in call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.1/lib/rack/urlmap.rb:50:in `each'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.1/lib/rack/urlmap.rb:50:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.1/lib/rack/head.rb:13:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.1/lib/rack/lint.rb:49:in `_call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.1/lib/rack/lint.rb:37:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.1/lib/rack/builder.rb:153:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-test-0.6.3/lib/rack/mock_session.rb:30:in `request'
/Library/Ruby/Gems/2.0.0/gems/rack-test-0.6.3/lib/rack/test.rb:244:in `process_request'
/Library/Ruby/Gems/2.0.0/gems/rack-test-0.6.3/lib/rack/test.rb:58:in `get'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/cli/build.rb:255:in `render_to_file'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/cli/build.rb:221:in `build_resource'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/cli/build.rb:213:in `each'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/cli/build.rb:213:in `execute!'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/cli/build.rb:128:in `invoke!'
/Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/cli/build.rb:70:in `build'
/Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
/Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
/Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
/Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/cli.rb:72:in `method_missing'
/Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:29:in `run'
/Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:126:in `run'
/Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
/Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
/Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/lib/middleman-core/cli.rb:20:in `start'
/Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.12/bin/middleman:18:in `<top (required)>'
/usr/bin/middleman:23:in `load'
/usr/bin/middleman:23:in `<main>'
== Request: /2015/05/27/daredevil-wears-prada/index.html
== Finishing Request: 2015/05/27/daredevil-wears-prada/index.html (0.0s)
     update  build/2015/05/27/daredevil-wears-prada/index.html
== Request: /tags/example/index.html
== Finishing Request: tags/example/index.html (0.0s)
     update  build/tags/example/index.html
== Request: /tags/tv/index.html
== Finishing Request: tags/tv/index.html (0.0s)
     update  build/tags/tv/index.html
== Request: /2015/index.html
== Finishing Request: 2015/index.html (0.0s)
     update  build/2015/index.html
== Request: /2015/05/index.html
== Finishing Request: 2015/05/index.html (0.0s)
     update  build/2015/05/index.html
== Request: /2015/05/27/index.html
== Finishing Request: 2015/05/27/index.html (0.0s)
     update  build/2015/05/27/index.html
== Request: /2012/index.html
== Finishing Request: 2012/index.html (0.0s)
     update  build/2012/index.html
== Request: /2012/01/index.html
== Finishing Request: 2012/01/index.html (0.0s)
     update  build/2012/01/index.html
== Request: /2012/01/01/index.html
== Finishing Request: 2012/01/01/index.html (0.0s)
     update  build/2012/01/01/index.html
There were errors during this build
rake aborted!
Command failed with status (1): [bundle exec middleman build --clean --verb...]
/Users/tterwilliger/dev/rewrite/Rakefile.rb:59:in `block (2 levels) in <top (required)>'
/Users/tterwilliger/dev/rewrite/Rakefile.rb:58:in `block in <top (required)>'
Tasks: TOP => publish => build
(See full trace by running task with --trace)

Can you post the contents of this file where the error occurs?

Also, I’ve noted that Middleman behaves differently when building the static site and running the local server. When running the server, current_article, article, and such allow for property access (i.e. article.url), while when building you need hash access (i.e. article['url']). I’m personally still trying to figure this out. But I just had a build error for that reason. Worth looking into.

It never creates the file-- that’s the verbose feedback I get from the build attempt.

I’ll look into your suggestion of using hash access instead of properties-- I know I use the properties in my templates.

The other weirdness is that I don’t even want that file and the “blog” directory shouldn’t be being built at all. As I mentioned, I’m not using the “blog” prefix in my setup.

Thanks for the reply!

Figured it out-- I referenced my blog layout from the root of the source folder. This caused the build to try to create a file for the layout as if it was a page. Once I moved the file to the layouts folder, I was able to build without error.