If you got a reference to a page-instance you can bind a href
to
its path directly. Use supply the page-href
binding the
page instance and the binding will calculate the correct path to the page.
This is useful when iterating over a collection of pages (see the menu to the left).
<ul data-bind="foreach: $__page__.children" class="nav nav-pills nav-stacked"> <li data-bind="css: {active: isVisible}"> <a class="lead" data-bind="page-href: $data"> <span data-bind="text: val('title')"></span> </a> <ul data-bind="foreach: children" class="nav nav-tabs nav-stacked"> <li data-bind="css: {active: isVisible}"> <a data-bind="page-href: $data"> <span data-bind="text: val('title')"></span> <!-- ko if val('desc') --> <span class="muted" data-bind="text: val('desc')"></span> <!-- --> </a> </li> </ul> </li> </ul>