Usage: {{#link href="/about/"}}About{{/link}}
{{#link}}
is a block helper that creates links with dynamic classes. In its basic form it will create an anchor element that wraps around any kind of string, HTML or handlebars constructed HTML.
With additional options it can have an active class
or target
behaviour, or onclick
JavaScript events. A href
attribute must be included or an error will be thrown.
<a></a>
element can be used in {{#link}}
. Check out the MDN documentation on the anchor element for more information.
activeClass
{{#link}}
will be nav-current
, this is consistent with our navigation helper. However it can be overwritten with the activeClass
attribute:
activeClass
ExampleactiveClass
can also be given false
value (activeClass=false
), which will output an empty string. Effectively turning off the behaviour.