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?

2 Likes

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.

the workaround with a cloudflare worker might be what you’re looking for.
I manage to implement a worker in this post, for the meta tags, that you can adapt a little for the canonical tag too.

It’s indeed not possible to do it using the custom code of the page but I managed to add it to the Cloudflare Worker thanks to @Slavo tutorial and @vfede shares on it through his post (thanks a lot by the way guys​:folded_hands: it really saved me :sweat_smile:).

Not sure why some people are saying the Worker doesn’t work anymore, I’m using Xano as a backend and everything works fine for me. I also managed to implement the injection of JSON-LD structured data through the worker if that’s something you also need. Don’t know if that’s still an issue for you but if it is (or if anyone is facing this issue) just tell me and I’ll try to share how I dit it here :+1:

I agree with @what.gift though, SEO optimization is extremely important for all of us I think. Having the best web-app in the world isn’t really worth it if you don’t have any users, and SEO plays a big role in this. The Cloudflare Worker is a good workaround but it’s a bit technical and - although doable - it’s a bit far from the no-code positionning of Weweb. In my modest opinion it should definitely be a priority, I guess we’re not the only ones with these SEO related issues :man_shrugging:t2:

Anyway have a nice day you all !

PS : For info, I added the canonical url because for a reason beyond my understanding 2 different ways of accessing the same dynamic collection page resulted in 2 different URLs : one with a “/” at the end (like usually through Weweb) and one without.

The dynamic page loaded with success in each situation but in terms of SEO it meant : possible dilution of my “crawling budget” + duplicated content for Google which could make my pages lose authority.

If you’re facing this “/” issue, I tried everything to have it at the end in both cases but nothing worked. I’d say, try to implement the Cloudflare Worker with an injection of canonical URL in it instead of wasting some time fixing the “/” missing. I mean you might figure out what went wrong, but for me it was a dead end :sweat_smile: