Impossible to set canonical url for dynamic and static collection page?

<html>
<head>
<title>Explore the world of dresses</title>
<link rel="canonical" href="https://example.com/dresses/green-dresses" />
<!-- other elements -->
</head>
<!-- rest of the HTML -->

I want to add the custom code like above to set the canonical URL for dynamic page but it seems it is not possible to add dynamic variable to the custom code…

Sooo that means that it is not possible to set up canonical URL for dynamic page?

Same for static collection page. I think there is no way to set different URL for each static page

3 Likes

I’m also stuck with this problem. I’ve tried adding a script to the <head> to inject canonical URL but it’s impossible as it can’t render it using variables.

It’s very frustrating because all dynamic content can’t be SEO optimised… actually, it can’t even be indexed which is even worse. It’s all hit and miss and Google Search console is picking up random URL’s that don’t exist as I can’t set dynamic canonical URLs which are a necessity!

Which means WeWeb is useless for an Ecommerce store!?

This is a major limitation with WeWeb in my opinion which isn’t getting the attention it needs and deserves. Surely there are thousands of people using dynamic content on WeWeb?

Can this be addressed by the team?

1 Like

WeWeb doesn’t seem to allow dynamic variables in the tag directly in custom code. A workaround could be using JavaScript to grab the current URL and inject it dynamically, but that’s not ideal for SEO. For static collection pages, you need to manually set canonicals for each one.

The problem is the current URL could be anything and for a canonical URL we need to fix it specifically. However, I did try this injection option and it’s not possible as the variables to access the dynamic properties are not available.

Adding a delay won’t satisify the SEO requirements where this all needs to work for the crawler.

Another idea I’ve had is to use Cloudflare HTMLReWriter paired with a Worker KV that stores the Canonical URL in cache ready to serve and inject. But setting this is up is time consuming and far removed from the “low code” route so I’ve yet to validate this theoretical option - as it’s new to me.

I could not agree more with you.
This is really huge problem for SEO yet it is not addressed. we are forced to figure out a workaround

1 Like

I wish there was a workaround I know of?! It’s not like this is edge case stuff, this is basic website building SEO 101.

My Google Search Console is so confused and has hundreds of non indexed URLs conflicting. Setting a dynamic sitemap hasn’t helped either as I can’t set it up on the domain. Google did pick up my RSS feed which helped with some.