Comments (11)
I think this is just a case of how the handlebars context works. Try using ../../page.basename .
Sorry... typing on my phone.
from handlebars-helpers.
I'm working on some navigation helpers too, I'd like to make this easier
from handlebars-helpers.
@doowb actually ../page.basename
worked but only for two links/pages I don't know why the third didn't work.
@jonschlinkert This will be great.
from handlebars-helpers.
In case anyone is looking for it, I believe this is some of the navigation helper documentation @jonschlinkert was referring to above.
from handlebars-helpers.
@ahmedelgabri after seeing this again, I just noticed that you had a space in the "about us" name and the page.basename probably doesn't have a space. I'm not sure if that could have been your issue.
Also, @andymcfee thanks for pointing to those documents. @jonschlinkert I noticed that he used an anchor tag to jump to that location. Did you ever get the anchor plugin added to the assemble docs?
from handlebars-helpers.
I manually added that anchor tag to the url.
from handlebars-helpers.
Also, I found the "../../" trick explanation in the Assemble Docs, but it was very brief and while it does work to fix the problem, it still feels like complete magic to me. Could someone point me to a blog/documentation for handlebars or whatever that explains what exactly is going on there?
from handlebars-helpers.
Yeah, the Handlebars Paths documentation talks about how to access parent context. Unfortunately for us Handlebars doesn't provide a root
variable or just find the correct property like Mustache does. Hope this helps.
from handlebars-helpers.
@ahmedelgabri and @andymcfee we've added a couple of things that will help you in creating this navigation.
We added a property on the pages in the pages
collection called isCurrentPage
.
@jonschlinkert also created this isActive handlebars helper that will use the isCurrentPage
property and generate a class="active"
attribute on your element. See the example for details on setting it up. You're also able to provide your own css class if you don't want to use active
.
I hope this helps. I'm going to close this issue, so re-open if you think it needs to be open.
from handlebars-helpers.
Thanks @doowb
from handlebars-helpers.
By chance is there a way to do this for gulp? The isActive helper does not work for me nor do the methods above.
from handlebars-helpers.
Related Issues (20)
- Comparation(#compare var1 "==" var2) with two variables doesn't work HOT 1
- Upgrade for new versions of the related plugins HOT 1
- does not export a 'register' function, cannot import HOT 1
- Create SECURITY.md
- Not splitting string by line breaks '\n' HOT 1
- todo: merge updates from https://github.com/Budibase/handlebars-helpers HOT 3
- Markdown Helper is broken...
- Vulnerability found (due to highlight.js) HOT 3
- isLast in nested forEach
- Titleize handlebar doesn't titleize input string correctly.
- Request: encode to hex HOT 1
- If loading all helpers the String helper reverse overrides the Array helper reverse. HOT 2
- An examples of working out averages on columns
- Handle empty fields
- String helper `split` doesn't split by empty string.
- This package does not install
- Fumanchu - A supported Handlebar + Handlebars-Helpers together! HOT 4
- query online
- Dead? Process to transfer ownership?
- Dependency "ent" uses deprecated Node punycode module
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handlebars-helpers.