Translation issues and URL issues with web pages build with metaobjects

Translation issues and URL issues with web pages build with metaobjects

GuillaumeA
Excursionist
18 1 13

I've defined an metaobject, which I have named "ingredient", with access to the online shop and with the web page functionality activated manually as explained here https://help.shopify.com/en/manual/custom-data/metaobjects/webpages.

Therefore, I have "ingredient" metaobjects and their associated pages.

Example: www.sowelab.com/pages/ingredient/bergamote

 

But there are 2 problems:

  1. I can't translate the URLs into other languages. Examplewww.sowelab.com/pages/ingredient/bergamote in Spanish should be www.sowelab.myshopify.com/es/pages/ingrediente/bergamota. But that doesn't seem possible. So I'm left with the following URL www.sowelab.com/es/pages/ingredient/bergamote for a page in Spanish. Useless to say that it is very penalizing in SEO.
  2. Even worse: when I use a dynamic field with my ingredients in a Collection or Product, the dynamic links systematically point to the ingredients pages in French. Example: The links to the metaobjects "ingredients" automatically listed on this Collection www.sowelab.com/es/collections/aceite-cosmetico-cbd in Spanish drive user to an ingredient page in French!

Am I the only one with this problem? Have I done something wrong in the configuration of my metaobjects pages?

 

What would you suggest?

Reply 1 (1)

ffiioonnaa
Excursionist
11 0 7

Hi! 

I'm very new to shopify and I'm not sure this will be of any help, but I managed a workaround for a similar issue I was having. It takes a few more steps, but it appears to work and allows me to translate the url text. 

In my case I wanted to display Vendor Names on my product pages that would link to the Vendor collection, and I wanted them to be fully translatable. The metaobject link wasn't allowing me to translate so I came up with this method instead. Since I'm so new to this I'm going to explain it in the context of my project so I don't confuse the steps:

 

1. Created a metaobject called Vendors (vendors). Inside each entry for Vendors I added 2 single text fields.
     1) Name (name)    2) Collection Handle (collection_handle)

2. I created automatic Collections based on my vendor names to group them all together. These collections are automatically given a handle which I copy to the next step (after I localize the Collection and its handle):

3. I filled out several entries for my metaobject (including the collection handle) and I localized them. 

2. Created a metafield under Products called Vendor Name (vendor_name). It references my Vendors metaobject. 

3. Go to my product, down to the custom metafield area and select my vendor name to associate with the product. 

4. In my theme's product template I add a custom HTML (or liquid) block.

     Inside the block I add:

 

 <a href="https://[your url goes here]/collections/{{ product.metafields.custom.vendor_name.value.collection_handle }}">
{{ product.metafields.custom.vendor_name.value.name }}
</a>
 
This will display my vendor name as a link that will connect to its associated collection, and it will be translated on my French site. 
Now, if the URL section still isn't working, instead of storing the Collection Handle in your metaobject you could potentially use the single text field to store the full URL text, in which case you might call the entry "Collection URL" and your code might look something like this:
 
<a href="{{ product.metafields.custom.vendor_name.value.collection_url }}">
{{ product.metafields.custom.vendor_name.value.name }}
</a>
 
This was all very confusing as I tried to figure out the proper key names to display my information on the front-end, but this appears to work. You may have to adapt the above information to work for your case, but perhaps its possible.
If this doesn't help you, I hope it might help someone else trying to achieve a similar effect!
 
Best,
Fiona