Forums / General / Multilingual meta tags
Paul Kemper
Tuesday 25 November 2008 11:06:07 pm
Hi all,
I am impressed with eZ and it's multilingual capabilities.
However: I could not find any reference to multilingual meta tags. I did see the descriptions on multi-lingual page content, admin interface, URL aliases.
But can I also have the page title, description/keyword meta tag in a translated version?
Paul Kemper http://www.tauros.eu
Frédéric DAVID
Wednesday 26 November 2008 1:15:58 am
The page title is already translated.
For description/keyword meta tag, if you have your website in different siteaccess, you can define foreach site different meta tags.
For example, if you have a siteaccess fr, language used is french. You put in your site.ini
MetaDataArray[description]=Système de Gestion de ContenuMetaDataArray[keywords]=cms, publish, e-commerce, gestion de contenu
and in a siteaccess en, language used is english. You put in your site.ini
MetaDataArray[description]=Content Management SystemMetaDataArray[keywords]=cms, publish, e-commerce, content management
Blog : http://www.frefred.fr/blog/ez-publish feZ Meta Data : http://projects.ez.no/fezmetadata
Arnaud Lafon
Wednesday 26 November 2008 1:37:02 am
Hi Paul,
all the metas are usually built by a template called page_head.tpl and you'll be able to override it. So If you define some class attribute like "site_title" or "site_metas" and enable translation, then you'll be able to customize your <meta /> and <title> tags for all your page.
Looking for information about SQLI ? Looking for a new job in Paris ? Please contact me at alafon [at] sqli [dot] com
Wednesday 26 November 2008 1:57:29 am
Contrary to Frédéric's example, I assume that every page in my site can have different meta tag contents. Am I correct?
Wednesday 26 November 2008 2:08:48 am
Yes it's possible. You'll have to modify the page_head template, but it's quite simple.
Wednesday 26 November 2008 2:59:35 am
Thanx Arnaud,
I will dive in and see if I can get a sample to work.
Kind regards,
Wednesday 26 November 2008 4:26:11 am
You're welcome. Just let me know If you need more information about this.
Greg Lakomy
Tuesday 02 December 2008 12:21:37 pm
You could also use global persistent_variable and set your title/keywords/description on individual objects and then pass those values back to page_layout or page_head
Example:
Set this in your template:
{set scope=global $persistent_variable=hash( 'seo_description',$node.object.data_map.description, 'seo_keywords', $node.object.data_map.keywords, 'seo_title', $node.object.data_map.title)}
Retrieve in page_head:
{$module_result.content_info.persistent_variable['seo_title'].content|wash}
Developer http://www.duoconsulting.com
Gaetano Giunta
Tuesday 02 December 2008 3:29:55 pm
I second Greg's solution - it allows to have different meta tags per every content object without creating a mess of ini settings or having to fecth the current node again in the pagelayout. Plus, since objects are translated, you will have automatically translated the meta-tags, too.
Just remember that you will have to add the template code that sets the persistent variable to every template overriding node/view/full of your website, or at least for all the content classes that have the meta-tags attributes.
An also remember to check in the pagelayout to see if the persistent var has been populated before using it. When you access a module other than content (such as user/login) it will not contain your meta-tags data.
Principal Consultant International Business Member of the Community Project Board