Simple Machines Community Forum

Customizing SMF => Graphics and Templates => Aiheen aloitti: Protonus - syyskuu 06, 2011, 11:32:26 IP

Otsikko: Trying to add meta property tags for Open Graph protocol... getting parse errors
Kirjoitti: Protonus - syyskuu 06, 2011, 11:32:26 IP
Hi, I'm trying to add some meta property tags for the Open Graph protocol (facebook) like it shows in this example:
https://developers.facebook.com/docs/opengraph (https://developers.facebook.com/docs/opengraph)
this is for the site at http://www.rocmoto.org  (http://www.rocmoto.org) - running SMF 2.0 gold.
I am trying to put them in index.template.php - AFAIK that is where they should go? 
I have tried putting them in several places in the code, figured after the <title> tag would be the correct spot, but no matter where I put them, I get parse errors and the template breaks and the page won't load after.  Here are the tag's I'm trying to add:

<meta property="og:title" content="RocMoto - life on two wheels"/>
    <meta property="og:type" content="website"/>
    <meta property="og:url" content="http://www.rocmoto.org/"/>
    <meta property="og:image" content="http://rocmoto.org/img/fb_thumb.jpg"/>
    <meta property="og:site_name" content="RocMoto - life on two wheels"/>
    <meta property="fb:admins" content="Protonus"/>
    <meta property="og:description" content="Rochester NY's motorcycle forum!"/>


I am assuming that the problem is I either need to add additional code to the file, or, my syntax is incorrect for the langauge the file is written in (XHTML?).  But I can't figure it out and would appreciate your help! 
Otsikko: Re: Trying to add meta property tags for Open Graph protocol... getting parse errors
Kirjoitti: Illori - syyskuu 08, 2011, 07:54:13 IP
please do not open more then one topic on the same issue, your other thread has been deleted.
Otsikko: Re: Trying to add meta property tags for Open Graph protocol... getting parse errors
Kirjoitti: Protonus - syyskuu 08, 2011, 08:56:30 IP
Lainaus käyttäjältä: Illori - syyskuu 08, 2011, 07:54:13 IP
please do not open more then one topic on the same issue, your other thread has been deleted.

sorry, thought I put it in the wrong forum, is this the right place?  Hadn't gotten any replies yet and I figure this was a pretty simple question?  I'm just not enough of a code jockey to figure it out but I figure anyone here that knows html and SMF well would know how to do this.
Otsikko: Re: Trying to add meta property tags for Open Graph protocol... getting parse errors
Kirjoitti: Illori - syyskuu 08, 2011, 08:58:04 IP
you are asking a question about a template so this would be the correct location, it is a matter of waiting for someone to reply that knows the answer. posting in 2.0 support would not help you as this is not a general 2.0 issue.
Otsikko: Re: Trying to add meta property tags for Open Graph protocol... getting parse errors
Kirjoitti: All Colours Sam - syyskuu 08, 2011, 09:29:35 IP
to be able to use opengraph metatags  you will need to edit your <html> tag in order to add the protocol:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:og="http://ogp.me/ns#"
      xmlns:fb="http://www.facebook.com/2008/fbml">


be careful, adding such a metatag will break the html validation in your website.


also, you will need to either add them to an existing echo  or add your own echo statement before the <head>  tag.
Otsikko: Re: Trying to add meta property tags for Open Graph protocol... getting parse errors
Kirjoitti: Kays - syyskuu 08, 2011, 10:04:56 IP
If you are adding it to an echo, you will also need to escape any single quotes with a backslash.

<meta property="og:description" content="Rochester NY\'s motorcycle forum!"/>
Otsikko: Re: Trying to add meta property tags for Open Graph protocol... getting parse errors
Kirjoitti: Mick. - syyskuu 08, 2011, 10:31:42 IP
NY's has to be like this :   NY\'s
Otsikko: Re: Trying to add meta property tags for Open Graph protocol... getting parse errors
Kirjoitti: Ricky. - syyskuu 08, 2011, 10:37:56 IP
Well, yes they do break site validation.
Anyways, I had taken once trouble of implementing Facebook OG.

If you like then you can download it Facebook Like with OpenGraph Support (http://ifandbut.com/talk/index.php?topic=50.0) , its also in mod approval queue though !

PS: its demo is live ifandbut.com
Otsikko: Re: Trying to add meta property tags for Open Graph protocol... getting parse errors
Kirjoitti: Protonus - syyskuu 19, 2011, 11:58:10 IP
Thank you everyone for your help! I've learned a lot as a result!  Ricky's mod also does 90% of what I wanted to do to start, and I'm gonna try and make it do the rest!  Ricky I posted my first two issues in your mod thread you linked to.   Thanks in advance.