LinkIt Docs

Link to anything and everything!


Installing

  • Unzip and place the LinkIt directory into /site/addons.
  • Run php please update:addons
  • You're done!

Usage

Add the fieldtype to your fieldset by using the link_it handle. The most basic configuration is the following:

fields:
  link:
    type: link_it

Content editors can then choose from all the following types:

Url

url

Custom

custom

Email

email

Tel

tel

Asset

asset

Containers array - You have to define the asset containers in the field settings to use this type.

fields:
  link:
    type: link_it
    containers:
      - documents

Term

term

Taxonomies array - You have to define the taxonomies in the field settings to use this type.

fields:
  link:
    type: link_it
    taxonomies:
      - blog_categories

Page

page

Entry

entry

Collections array - You have to define the collections in the field settings to use this type.

fields:
  link:
    type: link_it
    collections:
      - blog

You can configure which types are allowed by adding a types setting to your fieldtype.

Settings

This fieldtype supports the following settings. The default value is shown in the example.

Required

bool - Whether this field is required

fields:
  link:
    type: link_it
    required: false

Types

array - A set of types which content managers can choose from.

fields:
  link:
    type: link_it
    types:
      - asset
      - entry
      - custom
      - email
      - page
      - term
      - tel
      - url

To use the asset, entry and term types, please make sure you define the corresponding containers, collections and taxonomies settings.

Default

object - Set default values, for example a default type.

fields:
  link:
    type: link_it
    default:
      type: url

NewWindow

bool - Whether to give the choice to have links opened in a new window.

New Window

fields:
  link:
    type: link_it
    newWindow: false

Text

bool - Whether to allow a custom link text. (For example "Read more")

Text

fields:
  link:
    type: link_it
    text: false

Aria

bool - Whether to allow control over the aria-label.

Aria

fields:
  link:
    type: link_it
    aria: false

Title

bool - Whether to allow control over the link title.

Title

fields:
  link:
    type: link_it
    title: false

Append

bool - Whether to allow users to append something to the url.

fields:
  link:
    type: link_it
    append: false

The modifier

For easy usage, LinkIt comes with a modifier to generate a link tag or extract the necessary information.

{{ link | linkIt }}
{{ link | linkIt:target }}
{{ link | linkIt:text }}
{{ link | linkIt:url }}
{{ link | linkIt:title }}
{{ link | linkIt:aria }}
{{ link | linkIt:type }}