fgrehm / middleman-blog-drafts

An addon for middleman-blog that simplifies draft posts creation and publishing.
MIT License
20 stars 6 forks source link

Support middleman apps with multiple blogs? #9

Open stevegrossi opened 10 years ago

stevegrossi commented 10 years ago

I use middleman for a dev blog but have a second blog activated for portfolio items:

# config.rb
activate :blog do |blog|
  blog.name = 'posts'
end

activate :blog do |blog|
  blog.name = 'portfolio'
end

Adding activate :drafts to my config.rb throws the error:

/Users/steve/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/middleman-blog-3.5.2/lib/middleman-blog/helpers.rb:36:in `blog_controller': You must either specify the blog name in calling this method or in your page frontmatter (using the 'blog' blog_name) (RuntimeError)
from /Users/steve/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/middleman-blog-3.5.2/lib/middleman-blog/helpers.rb:50:in `blog'
from /Users/steve/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/middleman-blog-drafts-0.3.2/lib/middleman-blog-drafts/extension.rb:23:in `after_configuration'
from /Users/steve/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/middleman-core-3.3.2/lib/middleman-core/extension.rb:132:in `block in bind_after_configuration'
...

Removing the second call to activate :blog fixes it, but of course I need that. It would be nice if activate :drafts worked with an optional argument to specify which blog to use it with if multiple are present, e.g.

activate :drafts, blog: 'posts'
sgeb commented 10 years ago

Indeed middleman-blog-drafts does not support multiple blogs yet. This feature has been on my radar for some time but I haven't gotten around implementing it yet. @stevegrossi, thanks for opening this issue so we can track progress on this.