Replies: 1 comment
-
Looking at the code it didn't seem possible, so if anyone else needs to do this, here's what I have at the moment. I created a tag with the following: public function index()
{
$rv = array();
$parent_page = $this->context->get('parent');
$parent = null;
if ($parent_page) {
$raw = $parent_page->raw();
if ($raw) {
$parent = Entry::find($raw->id());
while (! is_null($parent)) {
$kv = [ "title" => $parent->title, "url" => $parent->url ];
array_unshift($rv, $kv);
$parent = $parent->parent();
}
}
}
// add current page to the end without a URL
if (count($rv)) {
array_push($rv, [ "title" => $this->context->get("title"), "url" => null ]);
}
return $rv;
} With the corresponding template:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to generate breadcrumbs for a collection?
{{ nav:breadcrumbs }}
fails to iterate over the parent, and instead always shows Home as the only entry in the hierarchy.I can confirm the grandparent/parent/child relationships are correct by using
{{ nav:collection:c :from="uri" }}
to show and dive into children.Details of what I'm using to diagnose:
I use this to dive down through the hierarchy, from the grandparent clicking the parent, then from the parent clicking the child.
But on each page, the following snippet only shows (on the child page, for example) "Home > Child" rather than "Home > Grandparent > Parent > Child"
Beta Was this translation helpful? Give feedback.
All reactions