html metatags plugin and multilingual posts
-
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
html metatags plugin and multilingual posts
I've noticed on one of my sites that the multilingual plugin doesn't seem to be working with the html metatags plugin. Changing the meta tags in a post automatically changes them for all languages. Am I doing something wrong, or are the two plugins not working together. If this is the case, can the HTML metatags plugin be upgraded to work with multilingual posts?
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: html metatags plugin and multilingual posts
Hi!
This is "intentional". Everything entered as entry properties in the advanced section always applies to one entry and is not translated.
The only fields that are changed are: Body, Extended Body and Subject. Everything else stays the same for everything.
Technically it would mean rewriting every single plugin to support multiple versions. Currently all plugins use the entry-id as distinct relation information, they would need to use entry-id + LANGUAGE as a relation. This sounds easy, but it surely is work of 1-2 hours for every single plugin that were to be supported...
But do not abandon hope yet. If you need to get this working and are not afraid to spend some work on it, you could solve it by no longer use the html-meta-desc plugin and using the custom entry properties as a drop-in-replacement. You could setup one entry property per language, like "meta_en", "meta_de", "meta_blabla" and then enter all language variants for the single entry.
Then you could edit your index.tpl template, and at the <head> section emit the meta tag with something like this:
HTH,
Garvin
This is "intentional". Everything entered as entry properties in the advanced section always applies to one entry and is not translated.
The only fields that are changed are: Body, Extended Body and Subject. Everything else stays the same for everything.
Technically it would mean rewriting every single plugin to support multiple versions. Currently all plugins use the entry-id as distinct relation information, they would need to use entry-id + LANGUAGE as a relation. This sounds easy, but it surely is work of 1-2 hours for every single plugin that were to be supported...
But do not abandon hope yet. If you need to get this working and are not afraid to spend some work on it, you could solve it by no longer use the html-meta-desc plugin and using the custom entry properties as a drop-in-replacement. You could setup one entry property per language, like "meta_en", "meta_de", "meta_blabla" and then enter all language variants for the single entry.
Then you could edit your index.tpl template, and at the <head> section emit the meta tag with something like this:
Code: Select all
{if $is_single_entry}
{foreach from=$entries item="dategroup"}
{foreach from="dategroup.entries" item="entry"}
{if $lang == 'de'}
<meta name="keywords" value="{$entry.properties.meta_de}" />
{/if}
{if $lang == 'en'}
<meta name="keywords" value="{$entry.properties.meta_en}" />
{/if}
...
{/foreach}
{/foreach}
{/if}
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
Re: html metatags plugin and multilingual posts
I've taken over from Carl, unfortunately he's not healthy enough to manage his blog and websites anymore; The code Garvin suggested above doesn't seem to be working on the site heres what we have in index.tpl
I looked in the source of the page and the plugin isnt' producing anything at all. Have we made a mistake?
thankx ceejay
Code: Select all
{if $is_single_entry}
{foreach from=$entries item="dategroup"}
{foreach from="dategroup.entries" item="entry"}
{if $lang=="hu"}
<meta name="description" value="{$entry.properties.DescriptionMagyar}" />
<meta name="keywords" value="{$entry.properties.KeywordMagyar}" />
{elseif $lang=="fr"}
<meta name="description" value="{$entry.properties.DescriptionFr}" />
<meta name="keywords" value="{$entry.properties.KeywordFr}" />
{else}
<meta name="description" value="{$entry.properties.DescriptionEn}" />
<meta name="keywords" value="{$entry.properties.KeywordEn}" />
{/if}
{/foreach}
{/foreach}
{/if}
thankx ceejay
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Re: html metatags plugin and multilingual posts
Hi ceejay - please tell Carl I said hello and wish him well.
Garvin's suggestion was for you to NOT use the plugin for your desired purpose, and instead use custom property fields using the extended properties for entries plugin.
I presume you have created your custom fields, such as DescriptionMagyar, KeywordMagyar, DescriptionFr, KeywordFr, DescriptionEn and KeywordEn... correct?
I think Garvin made a slight omission... those fields, when called from smarty should look like {$entry.properties.ep_DescriptionMagyar} (note the prefix "ep_").
I have not tried this personally, but I even wonder if the nested foreach loops are really required since you are testing for a single/detailed page view...
Garvin's suggestion was for you to NOT use the plugin for your desired purpose, and instead use custom property fields using the extended properties for entries plugin.
I presume you have created your custom fields, such as DescriptionMagyar, KeywordMagyar, DescriptionFr, KeywordFr, DescriptionEn and KeywordEn... correct?
I think Garvin made a slight omission... those fields, when called from smarty should look like {$entry.properties.ep_DescriptionMagyar} (note the prefix "ep_").
I have not tried this personally, but I even wonder if the nested foreach loops are really required since you are testing for a single/detailed page view...
=Don=
-
- Regular
- Posts: 1331
- Joined: Sun Dec 04, 2005 5:43 pm
- Location: Andalucia, Spain
- Contact:
Re: html metatags plugin and multilingual posts
Thx don
I tried what you suggested but it didn't work, but I found something in another theme that looked ok and it worked when I tried it.
thx Ceejay
I tried what you suggested but it didn't work, but I found something in another theme that looked ok and it worked when I tried it.
Code: Select all
{if $view == "entry" or $view == "start"}
{if $lang=="hu"}
<meta name="description" value="{$entry.properties.ep_DescriptionMagyar}" />
<meta name="keywords" value="{$entry.properties.ep_KeywordMagyar}" />
{elseif $lang=="fr"}
<meta name="description" value="{$entry.properties.ep_DescriptionFr}" />
<meta name="keywords" value="{$entry.properties.ep_KeywordFr}" />
{else}
<meta name="description" value="{$entry.properties.ep_DescriptionEn}" />
<meta name="keywords" value="{$entry.properties.ep_KeywordEn}" />
{/if}
{/if}
Re: html metatags plugin and multilingual posts
Sorry to hear Carl is feeling so bad. I hope things improve for him soon.
Re: html metatags plugin and multilingual posts
Sorry to hear about Carl's deteriorating health So more best wishes to pass on on my behalf, please
YL
YL