question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Navigation URL and Current Handlebar helpers inconsistent results

See original GitHub issue

When 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:closed
  • Created 8 years ago
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
ErisDScommented, Mar 20, 2019

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.

1reaction
mordkacommented, May 21, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found