{path:item_id:relation_field}

Description

Returns the chain of item ids from the root of a tree down to one item, as long ids joined by dashes (root first, the item itself last). It follows a relation field that points each item at its parent - the same field used to build a tree, a menu, or a Pages hierarchy. Use it for breadcrumbs and to know where an item sits in its tree. The second argument names the parent relation field and defaults to relation........ An item with no parent is its own one-element path. The id is not checked against the database: an id that matches no item is echoed straight back, and an empty first argument raises an error - always pass a real item id. See also tree, treestring, menu and sortstring, which walk the same relations.

Parameters

item_id required default (none)

The item whose path you want, as a long id (32 hex) or short numeric id. Required. {path:} does not check the id exists - a missing id is echoed back unchanged.

relation_field optional default relation........

The relation field to follow up the tree - the field on each item that points at its parent. Walking it from the item to the root, then reversing, gives the root-first path.

Examples

test{path:5726c2c6b035d7aab450d1794e9e90d7}
Expected5726c2c6b035d7aab450d1794e9e90d7
Actual5726c2c6b035d7aab450d1794e9e90d7
An item with no parent in the relation field is its own whole path. {path:} returns just that item's long id.
virtual{path:c0ffee00000000000000000000000003:relation........}
Expected(root-section-page, e.g. c0ffee00000000000000000000000001-c0ffee00000000000000000000000002-c0ffee00000000000000000000000003)
Actualc0ffee00000000000000000000000003
The real use: a tree built with a parent relation (e.g. the Pages slice field Subpage of...). {path:} walks from the page up to the root and returns the ids root-first - ready for a breadcrumb. Ids shown are illustrative.
test{path:00000000000000000000000000000bad}
Expected00000000000000000000000000000bad
Actual00000000000000000000000000000bad
A long id that matches no active item still echoes back as the path - {path:} does not verify the id exists. Always pass a real item id.
test{path:5726c2c6b035d7aab450d1794e9e90d7:relation.......1}
Expected5726c2c6b035d7aab450d1794e9e90d7
Actual5726c2c6b035d7aab450d1794e9e90d7
Pass a second argument to walk a different parent relation field. The default is relation........ Here the item has no value in relation.......1, so the path is just the item itself.