middleman / middleman-blog

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

Middleman blog frontmatter evaluating files under build directory #378

Open publitas-revolution opened 4 years ago

publitas-revolution commented 4 years ago

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:inload' 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:instart' 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:ininvoke_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:inblock 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:inblock 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:inpermalink_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

tdreyno commented 4 years ago

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

publitas-revolution commented 4 years ago

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.

markets commented 4 months ago

ℹ️ 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.