Jump to content

Add internal links in product/category (short) description with variables (not working!)


redfordnl

Recommended Posts

Hello everybody,

We are now working on our internal linking building. We have the website setup in 7 languages.

If we want add internal links to a product/category description we now have to look up every URL in all 7 languages and add them manually 1 by 1. So a lot of work, what we think can be done more quickly, but we can't find the right way.

 

In TPL files you can add the following code to a multilangual link for example:

<a href="{$link->getCMSLink(16)}" target="_blank">LINK TEXT</a>

<a href="{$link->getCategoryLink('12')}" target="_blank">LINK TEXT</a>

Etc...

 

But this is not working for category/product (short) descriptions in BO. The link is not working this way. It will add the variable behind yoursite-link this way:

https://yoursite.com/en/home/{$link->getCMSLink(16)}

https://yoursite.com/en/home/{$link->getCategoryLink('12')}

 

Are we doing something wrong? Any solution maybe?

Thanks in advance.

Edited by redfordnl (see edit history)
Link to comment
Share on other sites

Hey, redfordnl! Unfortunately, PrestaShop's WYSIWYG editor in the Back Office doesn't natively support dynamic variables like {$link->getCMSLink(16)} for internal links in descriptions. To simplify adding multilingual internal links, one approach is to use URL rewriting. Instead of adding each language-specific URL manually, you can try adding links without the language code, like /product-name, and PrestaShop should automatically redirect it to the correct language version based on the user's language settings.Alternatively, for a more automated solution, you may need to develop or find a custom module that automatically generates language-specific URLs in descriptions. This way, you can streamline the process for your internal linking across different languages without needing to update them manually every time.

Edited by NordicDesigner (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...