Page 1 of 1

html metatags plugin and multilingual posts

Posted: Tue Oct 28, 2008 11:15 am
by carl_galloway
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?

Re: html metatags plugin and multilingual posts

Posted: Tue Oct 28, 2008 2:08 pm
by garvinhicking
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:

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}
HTH,
Garvin

Re: html metatags plugin and multilingual posts

Posted: Sat Mar 07, 2009 10:26 pm
by carl_galloway
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

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}
I looked in the source of the page and the plugin isnt' producing anything at all. Have we made a mistake?

thankx ceejay

Re: html metatags plugin and multilingual posts

Posted: Sat Mar 07, 2009 11:39 pm
by Don Chambers
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...

Re: html metatags plugin and multilingual posts

Posted: Sun Mar 08, 2009 11:58 am
by carl_galloway
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.

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}
thx Ceejay

Re: html metatags plugin and multilingual posts

Posted: Mon Mar 09, 2009 3:22 pm
by judebert
Sorry to hear Carl is feeling so bad. I hope things improve for him soon.

Re: html metatags plugin and multilingual posts

Posted: Mon Mar 09, 2009 6:11 pm
by yellowled
Sorry to hear about Carl's deteriorating health :( So more best wishes to pass on on my behalf, please :)

YL