Streaming live at 10am (PST)

Problem with Canonical Tag

Hi guys,
I am new to web flow and I am struggling with canonical tag. I inserted the tags inside but apparently there is still something wrong and WF is showing a message saying: Custom code is not validated. Incorrect code may cause issues with the published page.

I inserted the following code:

Any clue about what am I missing? If anyone know a video (step by step) about inserting canonical tag on WF it will be very much appreciated.

Thank you so much!

Welcome to the Community @karlaassis :wave:

I’m not seeing the code you used specifically, but the notice you’re seeing is just letting you know that custom code isn’t verified before it’s added—meaning you’ll want to make sure it’s valid otherwise it may not work as expected. After publishing and checking the live site, any code you add will be included either in the head or body tags depending on where it was added in the settings.

That said, depending on your needs Webflow has a native global canonical tag field in the Project Settings that you can use in lieu of custom code:

Hi Mike,
Thank you so much for your quick reply.
Actually, I wasn’t sure about where would be the best place to insert canonical and considered the SEO field in the Project Setting. However, that field does not allow me to add lines. Is that correct?
Can I just insert a bunch of codes in the same line?

My work is focused on content strategy, this is my first hands on, technical SEO project.

About the code. I used this:

<link rel=”canonial” href=”https://blogcarros.carupi.com/categorias/tendencias/” />`
<link rel=”canonial” href=”https://blogcarros.carupi.com/categorias/novidades-tecnologia/” />
<link rel=”canonial” href=”https://blogcarros.carupi.com/categorias/carros/” />
<link rel=”canonial” href=”https://blogcarros.carupi.com/categorias/dicas/” />
<link rel=”canonial” href=”https://blogcarros.carupi.com/categorias/entretenimento/” />

But apparently it did not help. Semrush erros sky rocket after.
Thank you so much!
Cheers, Karla

Of course! And thanks for updating the code and giving me some extra information.

The canonical tag in the Project Settings is setting the root domain of the project (yoursite.com) and is used dynamically as needed across all of your other pages. So instead of indexing multiple versions of your root domain across all of your pages (https://www.yoursite.com, https://yoursite.com, etc) it would use the domain you set in your settings.

Keep in mind, this field doesn’t need any “code” and should only include the root domain with the protocol—and in your case, it looks like it would also include the subdomain:

https://blogcarros.carupi.com/

If you’d like to have more control over this tag and how it’s used on various pages of your site, you’d want to include a single instance of the canonical tag code on each page within the Page Settings <head> tag code section—each using the correct slug within the href attribute.

Obviously this is easy for “static” pages as their only used on a single page, but thankfully Webflow offers Dynamic Embeds within the Page Settings so you can assign the proper canonical URL based on the specific Collection Page using the slug field. Just above the Page Settings code window you’ll find a purple “+ Add Field” link that you can use to augment portions of your code with fields from the collection itself:

Hopefully that helps clarify things a bit, but don’t hesitate to reach out if you’ve got any other questions :+1:

Hi, Mike! Thank you so much for your explanation! Now I have a clear vision of canonical tag in WF. BTW, I did the changes in the root domain of the project and this solved 99% of my problems!!
Thanks a lot!

Cheers, Karla