Condition based on URL structure like /en/ and /de/

Hi

We are using Weglot to translate our website and they translate the site by adding the locale to the URL structure.

English = website.com/en/
German = website.com/de/

… and so on.

I have read an old forum post - Condition based on URL structure - where your support said that {{dc:url:segment}} is {{locale}} should be able to do it.


But I simply cannot make it work.

Can you help me out?

Thanks :slightly_smiling_face:

Hi @Mathias,

Thanks for reaching out.
I have checked the {{dc:url:segment}} in my local environment and found it working properly while showing the value from the URL or while using it in the condition. I would suggest you add the {{dc:url:segment}} into a text element and check if that is showing the correct value or not. If not, you can also test that by creating a new page and setting that as the child page of another page, and then add the code into the text element and check if that code is showing the parent page as a result of it. If not, there might be some different reasons behind your issue. I would like to suggest troubleshooting the following common issue to help us to recognize the reason.

1.Theme Related Issue
2.Plugin Conflict
3.Theme Update related issue ** if you have activated it
4.Child Theme Related issue
5.CSS/JS Customization
6.Disabling Cache
7.Permalink

If you discover that an issue is coming from a custom code or 3rd party plugin, kindly consult with a developer or contact the plugin author. Please note that we do not provide support for custom codes and 3rd party plugins.
If none of the above helps and you are still getting the issue, please provide login credentials for your site in a secure note to examine it further, including:

– WordPress Site URL & Login URL
– WordPress Admin username/password
– Specific Page where you are having this problem.

To create a secure note, click the key icon underneath any of your posts.

Thanks

Hi Tristan

I have added a secure note with the login credentials. Tried your suggestions but I never reach the first index of the url, the /en/.

The DC works fine when the page is a child page.

Please let me know what you think.

Hi Mathias,

I have tried to access your Page Builder and the page you mentioned but it seems different issues do not allow me to access the Page Builder and shows the error shown in the given screenshot.

There are some different reasons behind your issue, I would like to suggest troubleshooting the following common issue once again to help us to recognize the reason.

1.Theme Related Issue
2.Plugin Conflict
3.Theme Update related issue
4.Child Theme Related issue
5.CSS/JS Customization
6.Disabling Cache
7.Disabling CDN

If you discover that an issue is coming from a custom code or 3rd party plugin, kindly consult with a developer or contact the plugin author. Please note that we do not provide support for custom codes and 3rd party plugins.
If none of the above helps and you are still getting the issue, please copy your live site to a staging server so we could troubleshoot freely without breaking your live site.
And give us access to the secure note including:

– WordPress Site URL & Login URL
– WordPress Admin username/password

To create a secure note, click the key icon underneath any of your posts.

Thanks

Please let me know if this works for you. Thanks!

Hello @MathiasD,

I have logged in and checked your site. Weglot plugin may have changed the URL, still, the dynamic content {{dc:url:segment}} cannot detect en or de. Please compare the two URLs I have added in the secure note.

  • See the secure note.

Regretfully what you have in mind may not be possible with the conditions.

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.