Match

Use the match helper to render when a page matches a path; this is useful to highlight the current page in navigation menus.

Arguments

Parameters

Example

When the render output is passed as the second argument it is used:

<a {{match "/docs/" "class='selected'"}}>Documentation</a>

Or alternatively use the block syntax:

{{#match "/docs/"}}
<!-- This content is only rendered when the path starts with /docs/ -->
{{/match}}

By default matching is not exact so that navigating to child directories would also be considered a match on a parent navigation item.

Use the hash parameter exact to match exactly:

<a {{match "/docs/" "class='selected'" exact=true}}>Documentation</a>

Back to Helpers