Skip to content

Canonical issue in header request link #502

@mateoamilia

Description

@mateoamilia

Hi, I have an issue matching my canonical url in the head and the canonical link in the header request.

I use a custom field in my entries for my canonical URL entry.canonicalLink Its just a basic text field, where if my authors need to put a canonical, they paste it in there.

An SEO consultant pointed out that the canonical in the I am injecting this NOT by using the hook method, but instead a simple twig method like so:

I need a way to customize the header canonical URL with my custom field.
I tried to add this in the head, but does not work.

{# Canonical to be added by SEO plugin into http headers #}
{% if entry is defined and entry.canonicalLink|length %}
{% set seo = craft.seo.custom({ canonical: entry.canonicalLink }) %}
{% endif %}

If not, perhaps you know a way to disable the automatic injecting of the header canonical?

If anyone has an idea on how to make this work. I'd very much appreciate this.
Thanks!

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