Move navigation from _menu.json files in each navigation-parent directory to a naviga...
[ndcode_site.git] / _lib / breadcrumbs.jst
1 let assert = require('assert')
2
3 return async (env, _out) => {
4   // the breadcrumbs have already been determined by navbar.jst, as
5   // the HTML title is similar to the breadcrumbs (but without links)
6   let component_names = env.component_names
7   let component_titles = env.component_titles
8
9   // present component_titles as breadcrumbs, except last one as text
10   h2.mt-3 {
11     for (let i = 0; i < component_names.length; ++i) {
12       a.h4(
13         href=
14           `${
15             component_names.slice(0, i).map(name => '/' + name).join('')
16           }/index.html`
17       ) {`${component_titles[i]}`}
18       ' '
19       span.h5 {'>'}
20       ' '
21     }
22     `${component_titles[component_names.length]}`
23   }
24 }