I use a German localized version of Drupal and on my installation the og:description tag was incorrectly populated. Instead of the body, the code filled the field with the title.

After a bit of debugging, I found out that this has to do with the language version.

In the file opengraph_meta.common.inc the function get_node_body($node) uses the default language index 'und'

return (!empty($node) && !empty($node->body) && !empty($node->body['und']['0']['value'])) ? $node->body['und']['0']['value'] : '';

Since I have a German-only version 'und' is not defined and this should be true for any other international version as well. I would have to access the following field to get the correct description.

$node->body['de']['0']['value']

However, this would not work for non-German version, so my proposal to fix this bug is:

return (!empty($node) && !empty($node->body) && !empty($node->body[$node->language]['0']['value'])) ? $node->body[$node->language]['0']['value'] : '';

The line above works fine for me, can someone test it with another language please?

CommentFileSizeAuthor
#1 1333554-opengraph_meta.common.inc_.patch810 bytestoleillo

Comments

toleillo’s picture

StatusFileSize
new810 bytes

Hi,

This patch works for me.

hiddentao’s picture

Status: Active » Closed (fixed)

Fixed in dev.

hiddentao’s picture

@toleillo Thanks for the patch.

hiddentao’s picture

Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.