Greetings. I am new to working with October CMS. I need to change title for SEO for the product pages separately depending on the language (I have as many as 3 of them - Russian, English and Latvian). One template is responsible for displaying these pages. How can i do it?
For translation, you can download this plugin: Translate plugin - October CMS - php artisan plugin:install rainlab.translate
To update page properties based on language, refer to this example for URL translation using the viewBag: URL Translation Guide.
For translating the page title, you can use the localeTitle
attribute to assign different titles for each language version of your site. For instance, if your primary site is in English (en) and you have a Russian (ru) version, your code might look like this:
url = "/products"
layout = "default"
title = "Products"
[viewBag]
localeUrl[ru] = "/продукты"
localeTitle[ru] = "продукты"
==
<!-- Your HTML or PHP content -->
no need to plugin, when it can be done as multisite with multiple languages, right?
title = "Pakalpojuma Lapa"
url = "/pakalpojumi/:slug/:price?"
layout = "page"
is_hidden = 0
[viewBag]
localeTitle[en] = ""
localeTitle[ru] = ""
localeUrl[en] = "/product/:slug/:price?"
localeUrl[ru] = "/страница-продуктa/:slug/:price?"
[product]
slug = "{{ :slug }}"
price = "{{ :price }}"
[products]
count = 4
==
<div class="container py-5 page-content">
{% component "product" %}
</div>
<div class="container offers-container pt-5">
{% component 'products' %}
</div>
This is what my template looks like, which is responsible for displaying my product pages. I need to make a title for each such page with the language in which we are. I can’t figure out how to do it right
- Have you installed the RainLab.Translate plugin?
- Have you configured your site definitions under System → Site Definitions in the backend?
As a side note, I’m curious if there are any risks associated with having a non-Latin URL.
I already had the plugin installed. I didn’t make this site, I need to adjust some SEO points. I specialize in WordPress, but since October I have been working in CMS for the first time.