marnen / middleman-breadcrumbs

Breadcrumbs helper for Middleman (http://www.middlemanapp.com)
MIT License
11 stars 12 forks source link

When used in blogs, the root page is not listed #19

Open fkl21 opened 6 years ago

fkl21 commented 6 years ago

Hello there, I wanted to use this gem to generate breadcrumbs on my website, which consists of multiple blogs and some extra pages. The issue is that this gem produces for these extra sites breadcrumbs as such "/home/page". In my case, this is absolutely desired. However, for blog articles, it omits the 'root' page i.e. "home" and the breadcrumbs look like "/blogarticle".

I'd like to have consistent breadcrumbs i.e. "home/whatever", regardless if the current_page is a blog article or an extra page. Is there any chance to easily achieve my goal?

Best regards

marnen commented 6 years ago

The breadcrumbs are generated using the parent metadata to figure out the hierarchy. Is that not sufficient for your needs? If not, what would work?

fkl21 commented 6 years ago

hey, first of all, thanks for your reply! I reckon that the blog extension 'middleman-blog', '~> 4.0' does set the metadata 'parent' to nil for blog articles on its first level or so (blog.prefix is set, because there are a multiple blogs). Hence, when the helper function 'breadcrumbs( current_page)' is called on a blog page (since it's in the header partial), it just works its way up till the root level of the blog and not the root level of the project, which would have the 'home' page included. That being said, I did not debug the ruby code yet. I was hoping to find a simple solution without that ;)

marnen commented 6 years ago

So middleman-blog sets up its own hierarchy? That sounds like it might be an issue with that gem, not this one. Maybe not, though; I think both that gem and this one are interpreting parent reasonably for their context, but I'm not sure how we reconcile those interpretations.

Are #15 or https://github.com/middleman/middleman-blog/issues/303 helpful at all?