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

Middleman blog frontmatter evaluating files under build directory #378

Open
publitas-revolution opened this issue Mar 30, 2020 · 3 comments

Comments

@publitas-revolution
Copy link

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
@tdreyno
Copy link
Member

tdreyno commented Mar 30, 2020

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

@publitas-revolution
Copy link
Author

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.

@github-actions github-actions bot added the Stale label Apr 11, 2024
@markets
Copy link
Member

markets commented Apr 15, 2024

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

@github-actions github-actions bot removed the Stale label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants