248 Posts
Giuse
6 years ago
Topic

hi, in a multinguage site "Seblod way" (i.e. not duplicating articles per each language but translating the fixed values fields and duplicating free text fields), I found no way of having meta description multilanguage: changing seblod meta description field with a before render field will putput values as a normal content field and not in the head portion of the page.

So I tried the field 42 that supports PHP code for the prepare code phase/event: adding a new field with $doc->addMetadata() API works just for new metadata fields, not for metadata that already have a value, so override of metadata description does not work...

Any idea? Some other test to do?

Thanks a lot

Giuse 

Get a VIP membership
4229 Posts
Kadministrator
6 years ago
1
Level 1

As far as I know there is only setMetadata which sets new keys or modifies old ones, so this should work for you.

248 Posts
Giuse
6 years ago
0
Level 2

Sorry Klas, I wrote wrongly addMetadata but I am using setMetaData like you say and it does not override existing values:

$doc->setMetaData('Description', 'newvalue');

adds a new meta data row (since first letter is capital so it is considered as a new property) while

$doc->setMetaData('description', 'newvalue');

does nothing - old meta description remains what it is...

any guess? Thanks!

4229 Posts
Kadministrator
6 years ago
1
Level 1

Probably your metadata gets overwritten again by Joomla or Seblod itself. e.g. by metadata from Joomla language.Ypu will need a plugin that will run after that point, e.g. Joomla system plugin that runs at beforeRender and is set to the last place of Joomla plugins that handle this event.

248 Posts
Giuse
6 years ago
0
Level 2

Thanks Klas, I think it is exactly how you say: it's a (complex) problem of order of plugins...

Only way I found so far to set meta fields with field 42 is to have those fields empty (no default value to be overriden but always setting them as new fields).

cheers

Giuse

Get a Book for SEBLOD