marnen / middleman-breadcrumbs

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

Works with middleman-4 #7

Closed Jeeppler closed 8 years ago

Jeeppler commented 8 years ago

hello,

the plugin works with middleman-4, but make sure you have the title: your-title set for every page you use the plugin with. The plugin furthermore works with middleman-blog, but it does not work together with tag pages in middleman-blog. The reason is tags don't have parten elements.

marnen commented 8 years ago

Thanks for the report. Do you have a use case for using this plugin without the title attribute? It seems to me that it would only be meaningful to use it where a title can be deduced for the page.

I'm not at all familiar with the middleman-blog gem. How would you like to see middleman-breadcrumbs interact with it?

Jeeppler commented 8 years ago

First the problem is that middleman-blog tag pages don't have parent elements. This means you have to emulate what the breadcrumb plugin does:

<ul class="breadcrumbs">
    <!-- creates a breadcrumb till recipes.html -->
    <%= breadcrumbs sitemap.find_resource_by_path("/recipes.html"), wrapper: :li, separator: nil %>
    <!-- create the entry - without breadcrumbs helper -->
    <li><%= link_to( current_resource.data.title, "#" ) %></li>
</ul>

Second, if the page is already named correctly (e. g. about.html -> About) would be one of the use cases.

The main point about the title attribute is that you have not documented the need of setting a title attribute in your README.md documentation. It is important that useres are aware of the fact. I forgot to set the title attribute at the beginning and was surprised about the output of the breadcrumb plugin.

marnen commented 8 years ago

@Jeeppler:

First the problem is that middleman-blog tag pages don't have parent elements.

Then how would the breadcrumbs plugin be useful? Breadcrumbs are only meant for a hierarchical page structure -- this is not a general menu or tag cloud library. Or are you saying there is a hierarchy, but middleman-blog does not populate the metadata correctly for middleman-breadcrumbs to read?

Thanks for letting me know about the title issues. I can probably document that better and/or be smarter about deducing a title when one is not explicitly given.

Jeeppler commented 8 years ago

Or are you saying there is a hierarchy, but middleman-blog does not populate the metadata correctly for middleman-breadcrumbs to read?

Yes, this is exactly the case if you visit any page from a tag page. On the other hand the metadata is set correctly if you visit the page through a normal blog list summary page. E. g. recipes -> tag -> lunch -> 03_20_noodles_tomato //the metadata is set incorrectly recipes -> 03_20_noodles_tomato //the metadata is set correctly

marnen commented 8 years ago

I think you're misunderstanding what this plugin does, and possibly what the breadcrumbs UI pattern does for you. I gather that you would like this plugin to show a breadcrumb-style listing of your browser history, so that the same page might have different breadcrumbs depending on how you got there.

But that's not the goal of this plugin, nor is it really the purpose of breadcrumbs on websites. (Why should it be? We've already got the browser history for that.)

Rather, the point of the breadcrumbs pattern is to display where the page fits in in the hierarchy of the site. So whether you got to your noodle recipe from the tag page or from the summary page, the breadcrumb data should not change.

Put another way, breadcrumbs show where you are (relative to fixed reference points), not how you got there. They are a map, not directions. You can drive from New York to Boston by many routes, but Boston will always be at the same place on the map.


If I'm still misunderstanding your use case, please let me know, but otherwise this looks like a 'wontfix' (except for the documentation issues you raised, which are important).

marnen commented 8 years ago

I should have asked: in the case where you say the metadata is set incorrectly, what are you expecting to see, and what do you actually see?

Jeeppler commented 8 years ago

I completely understand that the breadcrumb is different from the browser history and breadcrumb show the hierarchy. The problem with the middleman-blog extension is, that they don't set the metadata parent attribute to the right value. They basically set the value to: nil

E. g. recipes -> tag -> lunch -> 03_20_noodles_tomato //03_20_noodles_tomato does not have a parent (expected parent recipes) recipes -> 03_20_noodles_tomato //the parent is set correctly to recipes

this is a middleman-blog issue.

There is nothing to fix besides the documentation: a) the title attribute is required b) mention it works with middleman-blog

marnen commented 8 years ago

Yeah, sounds like this is a middleman-blog issue. Thanks for the further explanation, and sorry for misunderstanding the first time around!