Edit on GitHub
Jump to docs navigation

Field Types / Slug field

Note: You are currently reading the documentation for Bolt 5.0. Looking for the documentation for Bolt 5.2 instead?

This field will determine what "slug" or permalink is used for accessing the record on the frontend. When omitted, the slug will be automatically generated.

Tip: The slug is a special value that's used in the generation of the URL at which a page will be available on the website. It usually contains a variant of the title, that's been made suitable for indexing by search engines. Ideally, it is both semantic and human-readable. For example, if you have a page named "About our company", a good slug would be about-our-company.

Basic Configuration

        slug:
            type: slug
            uses: title

Example usage in templates

The slug is not often used by itself, but rather as a part of a link. You can print the link to a record like this:

{{ record|link }}

{{ record|link(true) }}

The second example will output a canonical link to the record. This means that the link will include the full scheme, hostname and path, like https://example.org/page/about-us.

You can also just output the slug like this:

{{ record.slug }}

Options

The field has one option to change the functionality of the field:

Option Description
uses Determines what field(s) are used to build the slug. Usually you want this set to the textfield that you use as the title, (often called title), but you can also use it with multiple fields like for example [title, subtitle].
allow_numeric By default slugs are alphanumeric, and they start with a letter. So, if the "title" of a Record is "2021", the slug would become page-2021, to distinguish Slugs from IDs. If you wish to allow numeric slugs, set allow_numeric: true. Note that doing so might make it so a link like entry/9000 is no longer canonical: It could refer to either the entry with ID № 9000, or it could refer to the entry with slug 9000.

Note: Usually this field shows up in the editor with a label like Permalink:. If the ContentType is "viewless", there is no real permalink to the Record, so it will instead be labelled Unique Alias: to reflect this.



Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.