eleventy-plugin-nav 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  {% if trail.length > 0 %}
2
2
  <nav class="breadcrumbs">
3
3
  {% for ancestor in trail %}
4
+ <li>
4
5
  <a href="{{ ancestor.page.url }}">{{ ancestor.data.title }}</a>
5
6
  {% if ancestor.data.siblings.length > 1 %}
6
7
  <ul class="siblings">
@@ -9,5 +10,7 @@
9
10
  {% endfor %}
10
11
  </ul>
11
12
  {% endif %}
13
+ </li>
12
14
  {% endfor %}
15
+ </nav>
13
16
  {% endif %}
@@ -1,5 +1,5 @@
1
1
  <ul>
2
2
  {% for page in collection.roots %}
3
- {% include './sidebar-item.njk' %}
3
+ {% include './item.njk' %}
4
4
  {% endfor %}
5
5
  </ul>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleventy-plugin-nav",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Description",
5
5
  "keywords": [
6
6
  "eleventy-plugin"
package/src/config.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Default options
3
3
  */
4
4
  export const defaultConfig = {
5
- hidden: page => page.data.unlisted,
5
+ hidden: page => page.data?.unlisted,
6
6
  sort: { "data.order": 1, "data.title": "" },
7
7
  };
8
8
 
@@ -1,5 +1,4 @@
1
1
  import { getCollectionItemFromUrl } from "./util.js";
2
- import config from "../config.js";
3
2
 
4
3
  /** @typedef {import("@11ty/eleventy").CollectionItem} CollectionItem */
5
4
 
@@ -26,11 +25,6 @@ export function parentUrl (data) {
26
25
  let { parent, page } = data;
27
26
  let ret = getParentUrl(page.url, parent);
28
27
 
29
- if (config.ignoreAncestor?.(ret)) {
30
- let ancestorItem = getCollectionItemFromUrl(ret, data);
31
- return ancestorItem.parentUrl;
32
- }
33
-
34
28
  return ret;
35
29
  }
36
30
 
@@ -8,7 +8,7 @@ export function hidden (data) {
8
8
  ret = toArray(config.hidden).some(hidden => hidden(data.page));
9
9
  }
10
10
 
11
- return;
11
+ return ret;
12
12
  }
13
13
 
14
14
  export function shown (data) {
package/src/data.js CHANGED
@@ -6,3 +6,4 @@ export * from "./data/parent.js";
6
6
  export * from "./data/children.js";
7
7
  export * from "./data/ancestors.js";
8
8
  export * from "./data/siblings.js";
9
+ export * from "./data/visible.js";