Navigation URL and Current Handlebar helpers inconsistent results
See original GitHub issueWhen using @blog.navigation
directly (outside of a navigation.hbs partial) the {{url}}
and {{current}}}
handlebars helpers do not work correctly.
When using the {{navigation}}
template driven helper to pull in the navigation.hbs partial the {{url}}
and {{current}}}
handlebars helpers work as expected.
Both cases iterated over the navigation items using {{#foreach navigation}}
. In both cases {{label}}
worked as expected.
Tested this on index.hbs, page.hbs, post.hbs.
Issue Analytics
- State:
- Created 8 years ago
- Comments:21 (10 by maintainers)
Top Results From Across the Web
Node Express Handlebars helper not returning result of ...
The problem is that you are trying to return a value from an asynchronous function, but handlebars helpers are synchronous.
Read more >Handlebars Helpers Reference
This article is a reference for Stencil supported Handlebars helpers. It includes custom helpers documentation and a list of whitelisted standard helpers.
Read more >Handlebars Helpers for Custom Templates
Inline helpers. The simplest way to use helpers is inline. e.g. · Block helpers. Block helpers can help you do conditional statements and...
Read more >Built-in Helpers
If looking up license under the current context returns a falsy value, Handlebars will render the warning. Otherwise, it will render nothing. # ......
Read more >NetSuite Applications Suite - Use Custom Handlebars Helpers
Item Search Displays Incorrect Results · Category Product Lists Return Page Not Found ... URL for Commerce Categories Contains Incorrect Delimiters ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
2 weeks ago I took another good look at this issue. The refactor needed to make the behaviour between
@site.navigation
and the{{navigation}}
helper the same is fairly complex, which is why this issue is still open almost 4 years later. I still don’t see that there’s a particularly clear path to it right now.In Ghost 2.17 we added the ability to pass attributes to the
{{navigation}}
and{{pagination}}
so that it’s possible to do{{navigation header=true}}
, which will solve the main use case here, allowing for different markup in different locations.We are also experimenting with adding a link helper to handle the concept of “current”. I think between these features, we’ll have enough to cover most use cases. I’ll close this issue once the link helper goes in.
Hi @kevinansfield thanks for looking at this. I emphasized it’s still an issue because it’s been for 3 years around. I can’t use
{{navigation}}
because as previous posters and how it’s explained in #8972 I’m trying to list navigation items in other parts of the website in a different form and purpose. Maybe it’s hacking the blog system but I expected the core to have persistent behaviour and I find this as a flaw. Not a priority, I can workaround this by hardcoding few things but wanted to share the use case scenario.