link Object

Hyperlink object for use within content template displays.

Attributes

Attribute Required Description
title Yes string Link text and/or title.
url Yes string URL that the link points to.
id Yes number ID of link.
Attributes available when within context of a navigation object
active? No boolean Whether or not the user is visiting the page that this link points to or is a visiting a page listed underneath this link’s children.
children No array Collection of link objects that are children of this link within context of a navigation menu.

Category

Block Objects

Description

A link block object defines the blueprint for content blocks based on the base link content template. It represents a page to be linked to from a content block or a link within a navigation menu. When used in a content block, it is most useful when you want to split a link out separately from other content to be filled in.

Within your content templates’ displays, you would reference the block’s var_name containing the link data. (It won’t necessarily be named link but rather what you defined in the content_templates.json file.)

Here is an example display template using a link content block with a var_name of more_info_link:

      <a href="{{ more_info_link.url }}>{{ more_info_link.title }}</a>
      

And here is an example within context of a navigation menu:

      <nav class="global-nav">
        {% for link in navigation.links %}
          <a href="{{ link.url }}" class="global-nav-link {% if link.active? %}is-active{% endif %}">
            {{ link.title }}
          </a>
        {% endfor %}
      </nav>