
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
navigation-helpers
Advanced tools
Template helpers for Assemble Navigation
Assemble-Navigation is a middleware collection for use with Assemble to generate and inject hierarchal navigation data into a page's context. That page can then use a template or partial to build any kind of menu.
This collection of template helpers compliments Assemble-Navigation making it easier to create menus and breadcrumb trails.
See Assemble-Navigation's readme for more information on menu schemas and how to use them.
Note: a demo site for Assemble-Navigation and these helpers are in the works. That site will also have some more in-depth tutorials.
Block helper for querying menus and selecting the children of a submenu. Will create an array of menu items that can then be rendered. Includes sorting.
navigation.main.items
, navigation.footer.items
, etc.).key
but will inspect teh given array attribute for any matches to value
key
and sortBy
should be able to use nested property paths ('a.b.c') to access nested hashes. This was added to preform queries on Assemble view collections as well as menu-item collections.
<ul class="sidebar-menu">
{{#collectionQuery navigation.main.items key='linkId' value='about-index' includeParent=true property='items' sortBy='title' sortDir='asc'}}
<li><a href="{{{url}}}" >{{{title}}}</a></li>
{{/collectionQuery}}
<ul>
This helper parses a navigation menu and returns any items in the current page's active path (the page and it's parent, grandparent, etc.) to the inner block.
You can then output them using in any format you like.
{{#breadcrumb navigation.main}}
{{#if isActive}}
<a href='{{url}}'>{{title}}</a> »
{{else}}
{{title}}
{{/if}}
{{/breadcrumb}}
If you have Assemble and Assemble Navigation already setup and working, then you just need to configure the helper.
Install via npm...
npm i navigation-helpers --save
Add the helper to Assemble..
app.helpers(require('navigation-helpers'));
Backward compatible changes to collectionQuery
helper to give it the ability to filter by matching array properties using the inlist
parameter.
Backward compatible changes to collectionQuery
helper to give it the ability to filter based on nested properties.
Beta release. Future releases will likely add new helpers. I'd expect the APIs for existing helpers to remain the same.
Feel free to submit issues or pull requests for Navigation-Helpers. Questions on use can also be submitted to the issue queue.
There's a suite of unit tests. mocha test/*-spec.js
© 2016 John O'Donnell (Critical Mash Inc.) Released under the MIT license.
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.