anchor links remove the translation (/fr/) from the URL

Hi all,

This happens on the homepage. Let's say I have a block that, once clicked, redirects to a collection page. The anchor tag is something like

<a href="/collections/HANDLE">

Now I'm trying to have my store in multiple languages, so "href" needs to have (french, for example) "/fr/" before the link. It works fine when I use this:

href="{{ collections['HANDLE'].url }}"
/* which gives me */
href="/fr/collections/HANDLE"

but this doesn't work:

href="{{ collection.url }}"
/* which gives me */
href="collections/HANDLE"
/* instead of */
href="/fr/collections/HANDLE"

Just to clarify. I am on the translated homepage, so the like should point to the translated collection.

Does anyone know why this happens and if there is a workaround for this?

Thanks in advance

-Like and Mark as an Accepted Solution if my reply is helpful
I'm not an expert, these are my own experiences or codes that I gathered from others. I'm using Debut.
I have my own online pet supply store check it out at
PETLANTIS.CA
0 Likes

You could add /fr to the href:

<a href="/fr{{collection.url}}"> Bonjour</a>
<!-- Returns: /fr/collection/a-collection -->

 

Let's get Shopify figured out together. Get live USA-based customer service for your current or upcoming web project.
Email: hello@freshnarrative.io | tel: (443) 345-8162
Baltimore, Maryland, United States
We offer free and paid Shopify support.
Monday - Friday | 9 AM — 5 PM EST
0 Likes