Skip to content

[5.0.0] default template "meta.twig" -> robots values are not correct #498

@mfell

Description

@mfell

File: /src/templates/_seo/meta.twig

Current code:

{% if seo.robots -%}
  <meta name="robots" content="{{ seo.robots }}" />
{% endif %}

Issue:
This code always outputs the same meta tag value - <meta name="robots" content="none, noimageindex"> - regardless of whether a value is set or not.

Improved solution (suggestion):
The following code checks if there are any values in seo.advanced.robots and then joins them with a comma.
If no values are provided, it falls back to the default.

{% if seo.advanced.robots|length %}
  <meta name="robots" content="{{ seo.advanced.robots|join(',') }}" />
{% else %}
  <meta name="robots" content="none, noimageindex" />
{% endif %}

Result: <meta name="robots" content="noindex,nofollow">

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