You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a navigation entry named writing, with several child pages. Each child page has one or more tags. To facilitate easy browsing, I want to be able to display the tags of each child page (along with other metadata) when rendering the navigation <ul>.
---
title: &title A Brief History of Timeauthor: Stephen Hawkingtags:
- non-fiction
- physicseleventyNavigation:
key: a-brief-history-of-timetitle: *titleparent: writing
---
/writing/index.html (rendered)
<ul><li><ahref="/writing/moby-dick" class="title">Moby-Dick</a> by Herman Melville
<ul><li><ahref="collection/fiction" class="tag">#fiction</a></li><li><ahref="collection/whale" class="tag">#whale</a></li></ul></li><li><ahref="/writing/a-brief-history-of-time" class="title">A Brief History of Time</a> by Stephen Hawking
<ul><li><ahref="collection/non-fiction" class="tag">#non-fiction</a></li><li><ahref="collection/physics" class="tag">#physics</a></li></ul></li></ul>
But at the moment, page-specific information like tags or author isn't included in the entry returned by eleventyNavigation, making implementing this challenging.
Proposal
Inspired by the collection item data structure, add a field data to the entry returned by eleventyNavigation. This field would contain all data for this piece of content (includes any data inherited from layouts), minus the eleventyNavigation field (to avoid infinite recursion).
With this implemented, the above example could be written as:
I see this issue was already brought up in #17. It would be great to have an official word on whether this could be considered for inclusion in the library itself.
I have a navigation entry named
writing
, with several child pages. Each child page has one or more tags. To facilitate easy browsing, I want to be able to display the tags of each child page (along with other metadata) when rendering the navigation<ul>
.Example
/writing/moby-dick.md
/writing/a-brief-history-of-time.md
/writing/index.html (rendered)
See Archive of Our Own for a live example.
But at the moment, page-specific information like
tags
orauthor
isn't included in theentry
returned byeleventyNavigation
, making implementing this challenging.Proposal
Inspired by the collection item data structure, add a field
data
to theentry
returned byeleventyNavigation
. This field would contain all data for this piece of content (includes any data inherited from layouts), minus theeleventyNavigation
field (to avoid infinite recursion).With this implemented, the above example could be written as:
/writing/index.njk
The text was updated successfully, but these errors were encountered: