middleman / middleman-blog

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

Allow Multiple Blogs #37

Closed tdreyno closed 11 years ago

tdreyno commented 12 years ago

I'm thinking we should re-org our internals a little more. @bhollis has already done a ton.

I think we need a root Blog class which is initialized with a hash, instead of the set variable methods.

Old format:

activate :blog
set :blog_permalink, ":year/:month/:day/:title.html"

New format:

activate :blog, :permalink => "blog1/:year/:month/:day/:title.html"
activate :blog, :permalink => "blog2/:year/:month/:day/:title.html"
bhollis commented 12 years ago

The only issue there is that there are a lot of blog settings.

What do we want - just multiple [source, permalink] pairs, or completely separate blogs (different tag/calendar template, etc)? If it's the latter I'd just recommend people make separate middleman projects. If it's the former, it'd be pretty easy to do.

tdreyno commented 12 years ago

I can see a situation where you have 1 "site" project, such as a company website, with normal pages, and maybe a designer and a developer blog. I suppose you could have a couple MM projects and some script to coordinate building them all.

I'm not even sure activate can be called twice for the same extension right now.

tdreyno commented 12 years ago

We should do this in 3.1:

activate :blog do |blog|
  blog.permalink = "blog1/:year/:month/:day/:title.html"
end
bhollis commented 12 years ago

I like that idea.

doolin commented 12 years ago

+1

tdreyno commented 12 years ago

Will be a lot easier with the new extension class api (3.1) which uses instances for each activated extension.

davidwkeith commented 12 years ago

+1, many companies have blogs and press pages (which are essentially blogs)

mdorfin commented 12 years ago

+1 With this ability it will be possible organize the translated version of blog.

utensil commented 12 years ago

I can do

activate :blog do |blog|
  blog.prefix = 'blog1'
end
activate :blog do |blog|
  blog.prefix = 'blog2'
end

Things seem to work, but unfortunately the tags and calenders of two blogs are mixed up, which defeat the purpose.

lenaschoenburg commented 11 years ago

Is somebody working on this? I would love to use it to differ between blog and journal. Or is there any other to achieve something like this?

bhollis commented 11 years ago

Nobody's working on it. Feel free to take it on!

On Nov 14, 2012, at 9:30 AM, "Ole Krüger" notifications@github.com wrote:

Is somebody working on this? I would love to use it to differ between blog and journal. Or is there any other to achieve something like this?

— Reply to this email directly or view it on GitHubhttps://github.com/middleman/middleman-blog/issues/37#issuecomment-10375307.

lenaschoenburg commented 11 years ago

I am not so firm with ruby, and completely unfamiliar with the MM plugin system. Can you suggest some good reads to get started with the plugins?

bhollis commented 11 years ago

You should look at the code in this repository, and how activate works in https://github.com/middleman/middleman/blob/master/middleman-core/lib/middleman-core/core_extensions/extensions.rb. http://middlemanapp.com/extensions/custom/ has general info on the extension system.

lenaschoenburg commented 11 years ago

I would like to activate the extension multiple times like:

activate :blog do |blog|
  blog.prefix = 'blog1'
end
activate :blog do |blog|
  blog.prefix = 'blog2'
end

and dynamically add methods to the Blog module based on the prefixes. Any thoughts on this?

tdreyno commented 11 years ago

This might be dependent on my 3.1 refactoring of the extension system, which allows each extension to have its own instance instead of being a singleton on the Application. https://github.com/middleman/middleman/pull/460

ggarron commented 11 years ago

Nice to see this idea running. I was thinking about porting my site from Jekyll to MiddleMan. I have four blogs with jekyll. So, I will have to wait until this feature exists to make the move. Meanwhile I will be learning more about Middleman.

Thanks.

mikebmou commented 11 years ago

Anyone know if there has been much movement on this feature recently?

tdreyno commented 11 years ago

Nope. We're in a rough place. The volume of minor issues, and simply responding to questions, is eating up most of our time. New feature development is very slow.

The Plan is:

mikebmou commented 11 years ago

Ok cool. Open to help on the project? — Sent from Mailbox for iPhone

On Thu, Feb 21, 2013 at 10:27 AM, Thomas Reynolds notifications@github.com wrote:

Nope. We're in a rough place. The volume of minor issues, and simply responding to questions, is eating up most of our time. New feature development is very slow. The Plan is:

  • ship bugfix 3.0.12 this week.
  • beta and ship all changes from master (more dangerous, possibly backwards incompatibilities which need to be found)
  • Start work on new extension system for 3.1

* Use that system for multi-blog.

Reply to this email directly or view it on GitHub: https://github.com/middleman/middleman-blog/issues/37#issuecomment-13901391

tdreyno commented 11 years ago

So much :) Email me if you've got any questions or need any direction. We've got a pretty open commit policy. You want to help, you're in!

holden commented 11 years ago

Another use case I've found is using the blog features for a portfolio. It seemed a great fit, but now no blog! ;-(

twahlin commented 11 years ago

+1

tdreyno commented 11 years ago

This work is in-progress: https://github.com/middleman/middleman-blog/commit/c97ca96497432bbca11572901c93323a1e636512

holden commented 11 years ago

any idea when this will get into master?

tdreyno commented 11 years ago

This is in.

joallard commented 11 years ago

Fantastic! I'm trying it now, I haven't seen any documentation on multiple blogs, but I will try to document with my findings if I have time.

cockroachbill commented 11 years ago

Any tips on how to get started using multiple blogs?

utensil commented 11 years ago

@cockroachbill , @joallard , using multiple blogs is intuitive as:

activate :blog do |blog|
  blog.name = 'blog1'
  blog.prefix = 'blog1'
  # blablablah.....
end
activate :blog do |blog|
  blog.name = 'blog2'
  blog.prefix = 'blog2'
  # blablablah.....
end

One must specify the name of blog, it's the unique id of a blog for later reference. If you don't specify one, middleman-blog will generate one based on the sequential number. See https://github.com/middleman/middleman-blog/blob/master/lib/middleman-blog/extension_3_1.rb , line 65 in after_configuration.

The code in extension_3_1.rb is quite self explained, options, helpers, resource_list_manipulators, basically everything you need.

It's easy to figure out we should now write:

blog('blog1').tags.each

where we wrote:

blog.tags.each
utensil commented 11 years ago

I'm currently moving my old multiple blog workaround (just iterating sitemap and blahblah) to the new official multiple blog support, and hoping to write some documentation along the way.

In the meantime, I'm encountering issue #166 and hoping to solve it somehow.