README
@tigersway/eleventy-plugin-ancestry
A plugin for creating a real hierarchical navigation, following folders and documents, in Eleventy projects.
Install
npm install @tigersway/eleventy-plugin-ancestry
Open up your Eleventy config file (probably .eleventy.js
) and use addPlugin
:
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 subfolderscollections.all
elements.sorted
: Allows to sort any collection with a deep property.ancestors
(v0.5): Gives access to the parents/ancestors of the elements