https://github.com/tigersway/eleventy-plugin-ancestry
A plugin for creating a real hierarchical navigation, following folders and documents, in Eleventy projects.
https://github.com/tigersway/eleventy-plugin-ancestry
11ty collections eleventy eleventy-plugin tree
Last synced: 11 days ago
JSON representation
A plugin for creating a real hierarchical navigation, following folders and documents, in Eleventy projects.
- Host: GitHub
- URL: https://github.com/tigersway/eleventy-plugin-ancestry
- Owner: TigersWay
- License: mit
- Created: 2020-04-13T07:32:06.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-07T01:35:52.000Z (about 3 years ago)
- Last Synced: 2024-10-14T07:20:11.122Z (6 months ago)
- Topics: 11ty, collections, eleventy, eleventy-plugin, tree
- Language: JavaScript
- Homepage:
- Size: 42 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @tigersway/eleventy-plugin-ancestry  
A plugin for creating a real hierarchical navigation, following folders and documents, in Eleventy projects.
## Install [](https://www.npmjs.com/package/@tigersway/eleventy-plugin-ancestry)
```sh
npm install @tigersway/eleventy-plugin-ancestry
```Open up your Eleventy config file (probably `.eleventy.js`) and use `addPlugin`:
```js
const pluginAncestry = require("@tigersway/eleventy-plugin-ancestry");
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginAncestry);
};
```## Usage
See `sample/index.md` & `sample/_includes/base.njk` for examples how to access children/parent.
### Supplied filters
- `find`: Gives access to one - if it exists - `collections.all` element.
- `children`: Gives access to the folder or subfolders `collections.all` elements.
- `sorted`: Allows to sort any collection with a deep property.- `ancestors`(v0.5): Gives access to the parents/ancestors of the elements
### Notes
- As of today, the use of `_index` (to allow easier search of parent) is not included in Eleventy [#1057](https://github.com/11ty/eleventy/issues/1057) & [#774](https://github.com/11ty/eleventy/issues/774).
A permalink rewrite in root directory data file imposes `eleventyComputed` in `@11ty/[email protected]`!## CHANGELOG
**v1.0.3**
- Eleventy peer dependency corrected**v1.0.2**
- Chaining ancestors**v1.0.1**
- `permalink:false && eleventyExcludeFromCollections: true` are now possible
- Eleventy now peerDependency**v0.5.0**
- ...