---json
{
"description": "With the page-explorer component, you can add an explorer like panel that will list your pages in a list or collapsible tree fashion",
"name": "Page explorer",
"page_id": "6zpgpwnhbfqk69sjlio95",
"title": "Page-explorer: adding page navigation easily to your website"
}
---
====== ComboStrap UI - Page Explorer ======
===== About =====
A ''page-explorer'' is a [[docs:navigation:navigation|navigational component]] that creates a navigation bar in the form of:
* a ''list''
* or a collapsible ''tree'' (ie clickable levels of folder hierarchy)
This component is mostly used in a [[docs:theme:slot:side_slot|side slot]].
===== Example =====
==== Default List ====
A default ''page-explorer list'' pane can be asked with this minimal markup (the [[docs:styling:dimension|width]] options is cosmetic and can be deleted)
By default, the list will show the pages of the [[:docs:page:system:namespace|namespace]] from the requested page.
and will look like this where the label for each page is the [[docs:page:name|page name]]
==== Default Tree ====
A ''page-explorer tree'' does not need any template definition.
* with a minimal markup (The ''ns'' option is cosmetic and can be deleted, it permits to show two [[:docs:page:level|levels]])
* a page-explorer tree will look like this:
==== Custom List ====
[[$path| ... ${h1 | cut("-","2-") | trim()} ]]
[[$path| ${h1 | cut("-","2-") | trim()} ]]
where the ''page'' template is composed of:
* an [[docs:content:icon|icon]]
* a [[docs:content:link|link]] without [[docs:styling:underline|underline]]
* and a [[docs:templating:pipeline|pipeline]] to modify the [[docs:page:h1|heading 1]] of the page.
==== Custom Collapsible Tree ====
Example:
[[$path| Overview]]
${h1 | cut("-","2-") | trim()}
[[$path| ${h1 | cut("-","2-") | trim()}]]
where the ''page'' template is composed of:
* an [[docs:content:icon|icon]]
* a [[docs:content:link|link]]
* and a [[docs:templating:pipeline|pipeline]] to modify the [[docs:page:h1|heading 1]] of the page.
It produces:
===== Syntax and Templates =====
==== Syntax ====
template
template
template
template
where:
* The sub-elements define [[#template|templates]] for:
* ''page'' - a page,
* ''namespace'' - for a [[:docs:page:system:namespace|namespace]],
* ''index'' for a [[:docs:page:system:index|index page]]
* ''parent'' - for the parent [[:docs:page:system:namespace|namespace]]
* The page-explorer attributes are:
^ Attribute ^ Default ^ Possible Values ^ Description ^
| [[docs:styling:type|type]] | [[#list|list]] | [[#list|list]] or [[#tree|tree]] | It defines the layout |
| ''ns'' | the rendered page for a [[#list]] \\ the physical page for a [[#tree]] | | It defines the [[:docs:page:system:namespace|namespace]] that should be rendered |
''page-explorer'', ''index'', ''page'', ''parent'' and ''namespace'' are all [[docs:marki|superset HTML component]].
==== Templates ====
The templates define the output of each node in the ''list'' or ''tree'' layout:
* ''page'' defines a for each page in the namespace
* ''index'' defines a fragment for the [[:docs:page:system:index|index page of the namespace]]
* ''namespace'' defines a fragment for each child namespace of the actual namespace
* ''parent'' defines a fragment for the [[:docs:page:system:index|index page]] of the parent namespace of the actual namespace (used only in the [[#list|list layout]])
The below image shows you the mapping between the tag and their location in a ''list'' layout.
{{docs:block:page-explorer-list-name-to-ui-region.png|}}
The below image shows you the mapping between the tag and their location in a ''tree'' layout.
{{docs:block:page-explorer-tree-name-to-ui-region.png|}}
If a sub-element (''index'', ''parent'', ''namespace'') is defined without any template (ie empty content), they are not shown.
==== Default template ====
* if the ''page'' tag is is not defined, the below default ''page'' template is used
[[$path|$name]]
* if the ''namespace'' tag is not defined, a default namespace template is used
[[$path| $name]]
$name
* if the ''parent'' tag is not defined, a default parent template is used
[[$path| $name]]
* if the ''home'' tag is is not defined, the ''page'' template is used
===== Support =====
==== Performance consideration with the tree pane ====
The [[#tree|page-explorer tree]] is recreated when:
* a primary metadata (title, name, description) is modified ([[docs:cache:slot|primary meta dependency]])
* a page is added or deleted ([[docs:cache:slot|page system dependency]])
If your tree has a lot of pages, it may seems slow:
* while editing
* or for the first viewer