Dynamic collection adding "/en" in the URL automatically

Hi there,

I am having an issue with my dynamic links, I did not add any language tags, but when I publish the site, it has “/en” after the domain link and before my collection and ends up with " Page Not Found."

Can anyone tell me why this is happening? I will be really happy if someone can help me with this.
I am not sure if it’s Webflow bugs I never experienced this before.

Main project page,
https://www.atmgeeks.com/projects

When you click any of this projects, it should land below url

Instead it’s landing on this, adding an extra “/en”
https://www.atmgeeks.com/en/project/45-atms-programmed-install-and-bring-live-in-new-jersey


https://preview.webflow.com/preview/atm-geeks?utm_medium=preview_link&utm_source=designer&utm_content=atm-geeks&preview=77f2ddda3bf794b51d2f3e0d4510bc0c&pageId=6530143ffc258e9d7a17e24b&workflow=preview

1 Like

It’s a new bug connected to the migration to localization, I’m floored that such a major bug isn’t fixed after more than a week. This has the potential to do some serious SEO damage as well.

As a temporary fix, use this code, in the before-/body custom code area.
I’d probably put it site-wide so that it’s easy to add now, and then remove later once localization is fixed.

Note that when localization is fixed, your site will work fine even with this fix-code. However if you actually use localization it will be important to remove this so that your language-specific path redirects work as intended.

<!-- TEMPORARY /en/ bug fix 
     Remove once Webflow fixes localization. 
-->
<script>
// Find all /en/... links within collection list items
const links = document.querySelectorAll('.w-dyn-item a[href^="/en/"]');
links.forEach(link => {
    // Remove the /en prefix
    link.href = link.href.replace('/en', '');
});
</script>

Question, are you using automated sitemap generation?
I wanted to check if this has broken the sitemap as well but I’m not seeing CMS pages listed at all.
That’s better than broken /en/ links though. :thinking:

https://www.atmgeeks.com/sitemap.xml

My approach here is probably the best to safeguard your SEO, so Google doesn’t try indexing invalid URLs and de-list all of your CMS pages. However you could back it up with a wildcard redirect like this just in case anything slips through;

/en/project/(.*)/project/%1

2 Likes

Hey Michael, the script worked! Thanks!! However, I’m still having trouble getting the sitemap to work, even with the 301 redirect. Sitemap here: https://www.coffeeclozers.com/sitemap.xml

I’m worried about our SEO suffering. Do you think I should just create my own sitemap until the bug is fixed?

Also, I was referencing the localization documentation here and now I’m not sure if this is a feature or a bug?? I couldn’t figure out how to create different locales for our CMS.

Weird, so, yes, Webflow’s generated sitemap is indicating that all of your pages are under /en including your homepage. Search engines will just get 404’s on those pages.

Temporarily using a static sitemap is one quick way to fix it. Copy, edit, paste.
You MIGHT be able to hack that with this redirect as well, in this case I’d try-

/en(.*)%1

^ In some cases this wildcard formation will capture the entire path e.g. /blog/something rather than /en/(.*) which just captures a single path-segment between the /'s.

You might need an additional /en/ for the homepage.

Have you contacted support? I understand that for some users facing this bug support can add you to the localization beta, and that appears to resolve it.

1 Like

Thanks for the response! Still not working so I’m going to contact support and maybe do the static sitemap in the meantime. Thank you :blush:

1 Like

Any update on this? I added the snippet of code to my site, but I am still running into 404 issues.

For me it happens only with the blog collection. I have it switched on to Publish the collection, so it’s not that. The code snippet to remove /en is working, because /en was previously in the URL. Now it isn’t. But the links are still directing to 404.

If anyone can helps with this, it would be much appreciated !

Read only link :

Check the ‘Realisations’ page, at the bottom there are links to the blog

https://preview.webflow.com/preview/tinynaturebois?utm_medium=preview_link&utm_source=designer&utm_content=tinynaturebois&preview=7b7bb7329b0708ce6a59cc5d19b53303&pageId=660fd03ff5220192f25d19b3&locale=en&workflow=preview

Hi Lacy, none of your blog pages are showing here-
You may not have republished your site after switching on the publish blog collection setting?

https://tinynaturebois.webflow.io/sitemap.xml

And at the bottom of Realisations the blog doesn’t appear to have any links to the blog articles, I’m just seeing # null links.

Thanks @memetican , I had republished. I messaged support and they resolved the issue.