Navigation Item Link Tag HTML Object

When working with navigation items each {{ item.link }} value is an HTML Object.

The purpose of the HTML Object is to allow you to add or change the attributes for the link tag before outputting the link tag. Instead of having to manually build out the link tag just to set a custom class value you can set the attribute value and then simply output the link tag. This helps with readability and is often easier to write.

Instead of doing this:

<a href="{{ item.link.url }}" class="{{ item.link.class }} myClass">{{ item.link.text }}</a>

now you can set the class value and then simply output the code:

{% set item.link.class = item.link.class ~ ' myClass' %}
{{ item.link.tag }}

 Available link tag attributes

The following link tag attribtues are available for you to set or change values:

{{ link.accessKey }}
{{ link.class }}
{{ link.id }}
{{ link.onClick }}
{{ link.onDblClick }}
{{ link.onKeyDown }}
{{ link.onKeyPress }}
{{ link.onKeyUp }}
{{ link.onMouseDown }}
{{ link.onMouseOut }}
{{ link.onMouseOver }}
{{ link.onMouseUp }}
{{ link.rel }}
{{ link.tabIndex }}
{{ link.target }}
{{ link.text }}
{{ link.url }}

You can also set any valid HTML attribute on the link tag such as 'data' attributes.

See HTML Objects for more information about setting attribute values.