← API Index · How to use components
contentnavi component .oo-contentnavi
This component builds a menu for content from the system provided content pool (the shop's
mini CMS): it lists all published articles whose keywords contain a given key, and leads to a
page hosting the content component that shows the selected article. It is
addressed by the class oo-contentnavi, so a page can hold several menus picking
articles by different keywords. (Older documentation calls it .oo-contentmenu.)
Together with the content component this allows building a rich set of pages that is still easy to maintain by the shop operator: new articles with the right keyword appear in the menu automatically.
How components are mounted, how switch values are resolved and how debug output is enabled is described in the use-js-components skill.
<h1>Pages</h1>
<div class="oo-contentnavi" data-oo-content-page="content.html" data-oo-content-key="menupages"></div>
<h1>Recipes</h1>
<div class="oo-contentnavi" data-oo-content-page="content.html" data-oo-content-key="recipe"></div>
and on content.html:
<div class="oo-content" data-oo-content="url"></div>
component switches
| Switch | Default | Description |
|---|---|---|
oo-content-key |
– | Keyword used to select the articles for this menu: an article is listed if its keywords contain this string (case insensitive). Without a key, all articles are listed. Set it as data- attribute, as every menu needs its own value. |
oo-content-page |
content.html |
Page to dispatch to on a click; the article's short name is passed as ?sn=, which a content component with oo-content="url" picks up. If the click doesn't leave the page (same page, or a ? / :-value), the content component on the page is notified by event instead. |
Each menu entry gets the article's info text as tooltip (title). The entry whose article is
currently shown by the content component is marked with oo-active.
Events
| Element | Event | Description |
|---|---|---|
.oo-contentnavi |
oo-contentnavi-changed |
Fired with the selected article when a click doesn't change the page; the content component listens to it and loads the article in place. |
debug options
Debug scope cn (enable with data-oo-debug="true" on the element or debug:cn:all+, see the skill):
| Term | Description |
|---|---|
cn:all |
Key and page resolved, articles checked and matched, clicks. |