Hi All,
Need a little bit of help with customizing a few index pages. I am trying to remove the subscribe button on some index pages that gets inserted in the default template. I have a sub template that inherits for that custom route.
Since I have to change code in the inherited template, I’m updating the default template to add code based on the URL route.
I have the following but it never proves true, even though the return url is exactly ‘‘/alec/”:
{{#match url "/alec/"}}
YES {{url}}
{{else}}
NOT {{url}}
{{/match}}
What am I doing wrong?
I solved it by adding a CSS class for display:none and then inserting that class into the default template button with #contentFor handlebars from the sub template.
But it would still be nice to know what I was doing wrong with the match?
Still running into issue here. Trying to add a default image for different index pages depending on the routing file. So was hoping to look at the url and then match the image on that, but can’t seem to get #mathc again to work?
{{#match url "~" "art"}}
src="{{asset '/images/ha-cha-art.png'}}"
{{else match url "~" "books"}}
src="{{asset '/images/ha-cha-books.png'}}"
{{else}}
src="{{asset '/images/ha-cha-games.png'}}"
{{/match}}
I’m sure it’s a simple syntax issue, but not sure were I am making the mistake.
Got it. Did it with parenthesis to call the full url helper. Be nice if the ghost documentation has a few examples of that for calling helpers within helpers.
{{#match (url absolute="false") "~" "art"}}
src="{{asset '/images/ha-cha-art.png'}}"
{{else match (url absolute="false") "~" "books"}}
src="{{asset '/images/ha-cha-books.png'}}"
{{else match (url absolute="false") "~" "games"}}
src="{{asset '/images/ha-cha-games.png'}}"
{{else}}
src="{{asset '/images/ha-cha-random.png'}}"
{{/match}}
That would be a great example to add to the docs! They’re open, so you could file a PR on Github!