Skip to content

ensure_right doesn't work with |  #4249

@tao

Description

@tao

Bug Description

I'm working on SEO titles for my website, the common convention is to use title | site name. I'm overriding some of my pages and want to fall back to site name when I break something... I want to avoid | site name in the title.

I thought I'd use ensure_right to get around this:

<title>{{ title ensure_right=" |" }} {{ config:app:name }}</title>

However, I found this doesn't work. I assume | is reserved for use in conditional statements or the parser is getting confused about it. Although I found that & works fine.

With different characters it works as expected:

<title>{{ title ensure_right=" @" }} {{ config:app:name }}</title>
<title>{{ title ensure_right=" ," }} {{ config:app:name }}</title>
<title>{{ title ensure_right=" ," }} {{ config:app:name }}</title>
<title>{{ title ensure_right=" &" }} {{ config:app:name }}</title>
<title>{{ title ensure_right=" !" }} {{ config:app:name }}</title>

It seems like most other options work fine except |.

Environment

Statamic 3.2.1 Pro
Laravel 8.56.0
PHP 8.0.6
statamic/ssg 0.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions