eleventy-navigation
eleventy-navigation copied to clipboard
Add aria-current option
Fixes #14
It adds a useAriaCurrentAttr
option so that an anchor matching the activeKey
will have an aria-current="page"
attribute (see more details here).
Example Nunjucks navigation rendering:
{{ collections.all | eleventyNavigation | eleventyNavigationToHtml({
activeKey: eleventyNavigation.key,
useAriaCurrentAttr: true
}) | safe }}
The PR also includes a refactor to make adding tag attributes a bit simpler.
- [x] Changes have test coverage
- [x] Have verified works in an Eleventy site build
- [ ] Documentation updated