updating to 2.x open graph content disappears

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
grazia
Forum Members
Forum Members
Posts: 21
Joined: Wed Dec 05, 2012 10:28 am

updating to 2.x open graph content disappears

Post 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? ???
grazia
Forum Members
Forum Members
Posts: 21
Joined: Wed Dec 05, 2012 10:28 am

Re: updating to 2.x open graph content disappears

Post 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?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: updating to 2.x open graph content disappears

Post by velden »

I assume the $entry variable comes from a module detail template like News?

In that detail template try something like

Code: Select all

{$og_entry=$entry scope=global}
Then in your og meta tags use $og_entry in stead of $entry.

I didn't test this at all but worth to try.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: updating to 2.x open graph content disappears

Post by Rolf »

I am working on a new tutorial describing how to make this, will be ready within a week I think.
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
grazia
Forum Members
Forum Members
Posts: 21
Joined: Wed Dec 05, 2012 10:28 am

Re: updating to 2.x open graph content disappears

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: updating to 2.x open graph content disappears

Post 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
grazia
Forum Members
Forum Members
Posts: 21
Joined: Wed Dec 05, 2012 10:28 am

Re: updating to 2.x open graph content disappears

Post by grazia »

yes, I use it only in News template.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: updating to 2.x open graph content disappears

Post 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.

Code: Select all

{$og_entry=$entry scope=global}
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}" />
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: updating to 2.x open graph content disappears

Post by Rolf »

The tutorial describing this method in detail:
http://www.cmscanbesimple.org/blog/base ... d-metatags
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
grazia
Forum Members
Forum Members
Posts: 21
Joined: Wed Dec 05, 2012 10:28 am

Re: updating to 2.x open graph content disappears

Post by grazia »

Thank you Velden, now I understand the concept.
Thank you so much. :-*
Post Reply

Return to “CMSMS Core”