Closed gma closed 10 years ago
Should category priority be considered or should the first category sorted alphabetically be selected?
If a top level page has a category that also has a category is it ok to display the full category hierarchy?
So instead of just "Home > Bugatti Veyron" the breadcrumb would display "Home > Cars > Supercars > Bugatti Veyron" etc.
I ask because I think Page#parent
will have to continue up the category chain.
Yes, what this ticket is about what you've described as "Home > Cars > Supercars > Bugatti Veyron".
If memory serves all we need to do is to get Page#parent
to pull the first category off the list of categories, as the breadcrumb_ancestors
method already does the loop (i.e. Page#parent
should only return a single page, or nil
).
There are already some specs for the #parent
method in models_spec.rb
.
If
http://hostname/page-1
is in thepage-2
category, I’d like the breadcrumb to say “Home > Page 2 > Page 1”. The breadcrumb is currently just built from the path, so it would say “Home > Page 1”.The breadcrumb is built from the
Page#parent
method.I’d like
Page#parent
to return a page object for the parent (derived from the URL) or fall back to the page for the first category for pages that sit at the root of the site. If a page sits at the top level and doesn't have any categories, the home page would be returned.I think this would sort out the breadcrumb.