middleman-blog icon indicating copy to clipboard operation
middleman-blog copied to clipboard

Middleman blog frontmatter evaluating files under build directory

Open publitas-revolution opened this issue 4 years ago • 3 comments

Expected behaviour

Middleman build should compile all the blogs

Actual behaviour

After upgrading to latest middleman-blog I am getting this error

== Blog Sources: /blog/{title}/index.html (:prefix + :sources)

webpack is watching the files…

Traceback (most recent call last): 50: from /Users/umerkhan/.rbenv/versions/2.5.3/bin/middleman:23:in <main>' 49: from /Users/umerkhan/.rbenv/versions/2.5.3/bin/middleman:23:in load' 48: from /Users/umerkhan/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/middleman-cli-4.3.6/bin/middleman:70:in <top (required)>' 47: from /Users/umerkhan/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/base.rb:485:in start' 46: from /Users/umerkhan/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor.rb:392:in dispatch' 45: from /Users/umerkhan/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in invoke_command' 44: from /Users/umerkhan/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/command.rb:27:in run' 43: from /Users/umerkhan/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor.rb:40:in block in register' 4: from /Users/umerkhan/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/middleman-blog-4.0.3/lib/middleman-blog/blog_data.rb:129:in each' 3: from /Users/umerkhan/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/middleman-blog-4.0.3/lib/middleman-blog/blog_data.rb:145:in block in manipulate_resource_list' 2: from /Users/umerkhan/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/middleman-blog-4.0.3/lib/middleman-blog/blog_data.rb:239:in template_path' 1: from /Users/umerkhan/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/middleman-blog-4.0.3/lib/middleman-blog/blog_data.rb:214:in permalink_options' /Users/umerkhan/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/middleman-blog-4.0.3/lib/middleman-blog/blog_article.rb:228:in `date': Blog post blog/product-update-banner-embed-code/index.html needs a date in its filename or frontmatter (RuntimeError)

I think the issue is middlman-blog is trying to evaluate files under build/blog/ which are already compiled and will not have the date formatter it is looking for.

Additional information

If I remove the build directory and run middleman server everything works fine and blogs are rendered as usual. But after middleman build everything breaks.

Here is my Blog block:

activate :blog do |blog| blog.prefix = "blog" blog.layout = "blog_post" blog.permalink = "/{title}" blog.sources = "/{title}/index.html" blog.new_article_template = "source/blogpost.template.erb" blog.default_extension = ".erb" blog.tag_template = "blog/tag.html" blog.taglink = "tags/{tag}/index.html" blog.year_template = "blog/calendar.html" blog.year_link = "/{year}/index.html" blog.month_link = "/{year}/{month}/index.html" blog.day_link = "/{year}/{month}/{day}/index.html" blog.paginate = true blog.per_page = 10 end

  • Ruby version: 2.5.3
  • Middleman version: 4.3.6
  • Middleman Blog version: 4.0.3
  • OS version: Mac 10.15.2 / Ubuntu 16.04

publitas-revolution avatar Mar 30 '20 08:03 publitas-revolution

I would expect the sources to be markdown files or erb?

tdreyno avatar Mar 30 '20 17:03 tdreyno

Thanks for the quick response. Yes, they are. Below is the file in source directory against which I am getting above error: image

But it looks like middleman-blog is trying to apply the blog-template on the html files in the build directory which is causing this error. If I remove the build/ directory middleman starts and build successfully.

publitas-revolution avatar Mar 31 '20 05:03 publitas-revolution

ℹ️ This issue is stale because it has been open for more than 90 days with no activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

markets avatar Apr 15 '24 18:04 markets