Page 1 of 1
updating to 2.x open graph content disappears
Posted: Tue Jul 12, 2016 11:00 am
by grazia
hello,
I have a new problem. After update to 2.x all what I insert in metadata open graph don't appear.
For example
<meta property="og:image" content="{$entry->file_location}/{$entry->fields['immagine']->value}" />
<meta property="og:title" content="{$entry->title}" />
<meta property="og:url" content="{$entry->canonical}" />
on html source become:
<meta property="og:image" content=" " />
<meta property="og:title" content=" " />
<meta property="og:url" content="" />
With precedent version they worked... what ca I do?

Re: updating to 2.x open graph content disappears
Posted: Tue Jul 12, 2016 11:14 am
by velden
Re: updating to 2.x open graph content disappears
Posted: Wed Jul 13, 2016 7:56 am
by grazia
thank you.
I made several attempts reading this page, but I don't find the working syntax. Please, can you make me an example with metadata og content?
Re: updating to 2.x open graph content disappears
Posted: Wed Jul 13, 2016 8:04 am
by velden
I assume the $entry variable comes from a module detail template like News?
In that detail template try something like
Then in your og meta tags use $og_entry in stead of $entry.
I didn't test this at all but worth to try.
Re: updating to 2.x open graph content disappears
Posted: Wed Jul 13, 2016 9:44 am
by Rolf
I am working on a new tutorial describing how to make this, will be ready within a week I think.
Re: updating to 2.x open graph content disappears
Posted: Wed Jul 13, 2016 2:17 pm
by grazia
if you post a tutorial can you make a link in this post so I can find it?
My attempts don't work

this for example
<meta property="og:title" content="{$og_title=$entry->title scope=global}" />
is wrong.
Re: updating to 2.x open graph content disappears
Posted: Wed Jul 13, 2016 2:29 pm
by velden
Read carefully what I wrote before:
I assume the $entry variable comes from a module detail template like News?
In that detail template try something like
Re: updating to 2.x open graph content disappears
Posted: Wed Jul 13, 2016 3:10 pm
by grazia
yes, I use it only in News template.
Re: updating to 2.x open graph content disappears
Posted: Wed Jul 13, 2016 3:23 pm
by velden
Makes no sense.
Code: Select all
<meta property="og:title" content="{$og_title=$entry->title scope=global}" />
I doubt you're displaying the meta tag in your detail template, right?
My suggestion is/was (and please try to understand the concept):
somewhere in your NEWS DETAIL template:
Copy the $entry variable to $og_entry and give $og_entry a global scope.
Use $og_entry (should be possible because it has global scope).
PAGE template:
Code: Select all
<meta property="og:image" content="{$og_entry->file_location}/{$og_entry->fields['immagine']->value}" />
<meta property="og:title" content="{$og_entry->title}" />
<meta property="og:url" content="{$og_entry->canonical}" />
Re: updating to 2.x open graph content disappears
Posted: Wed Jul 13, 2016 5:13 pm
by Rolf
Re: updating to 2.x open graph content disappears
Posted: Wed Jul 13, 2016 8:55 pm
by grazia
Thank you Velden, now I understand the concept.
Thank you so much.
