<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Facebook | Nerdpress.org</title>
	<atom:link href="https://nerdpress.org/tag/facebook/feed/" rel="self" type="application/rss+xml" />
	<link>https://nerdpress.org</link>
	<description>...dev, tech problems and solutions.</description>
	<lastBuildDate>Thu, 14 Jun 2012 15:33:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Opengraph MetaTags in SilverStripe</title>
		<link>https://nerdpress.org/2012/06/14/opengraph-metatags-in-silverstripe/</link>
					<comments>https://nerdpress.org/2012/06/14/opengraph-metatags-in-silverstripe/#comments</comments>
		
		<dc:creator><![CDATA[Ivo Bathke]]></dc:creator>
		<pubDate>Thu, 14 Jun 2012 15:33:41 +0000</pubDate>
				<category><![CDATA[Silverstripe]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[OpenGraph]]></category>
		<guid isPermaLink="false">https://nerdpress.org/?p=2208</guid>

					<description><![CDATA[<p>First off some general thoughts on how to use opengraph metatags. Since the uprise of Social Media, sharing sites, deeplinking and snippetting content has become a important aspect of SEO and so almost every site has some kind of facebook-like-button to let user easily share the page. Most sharing endpoints, facebook f.e, bring a more &#8230; </p>
<p class="link-more"><a href="https://nerdpress.org/2012/06/14/opengraph-metatags-in-silverstripe/" class="more-link">Continue reading<span class="screen-reader-text"> "Opengraph MetaTags in SilverStripe"</span></a></p>
The post <a href="https://nerdpress.org/2012/06/14/opengraph-metatags-in-silverstripe/">Opengraph MetaTags in SilverStripe</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></description>
										<content:encoded><![CDATA[<p>First off some general thoughts on how to use opengraph metatags.<br />
Since the uprise of Social Media, sharing sites, deeplinking and snippetting content has become a important aspect of SEO and so almost every site has some kind of facebook-like-button to let user easily share the page.<br />
Most sharing endpoints, facebook f.e, bring a more or less good parser/linter to summarize the page content. So the first text paragraph will be taken as text snippet and all images that fit certain requirements will be offered to chose a preview-thumbnail from.<br />
So far so good.<br />
<span id="more-2208"></span><br />
But sometimes you want to have control of the content that is used for the preview on the sharer site.<br />
And thats where the opengraph metatags come into play. With them you can specify title, description and image of the preview snippet.</p>
<p>Thats great, but it has some caveats, which i like to describe while introducing the silverstripe <a href="https://github.com/tractorcow/silverstripe-opengraph">opengraph module</a> by Damian Mooyman.</p>
<p>The module is pretty well done and delivers most content prefilled. So just install it and the rest comes automatically through the <em>$MetaTags</em> var in your template.<br />
In the backend you can insert some information like locality and your facebook app id.<br />

<a href='https://nerdpress.org/wp-content/uploads/2012/06/facebook-opengraph-silverstripe.png'><img decoding="async" width="150" height="150" src="https://nerdpress.org/wp-content/uploads/2012/06/facebook-opengraph-silverstripe-150x150.png" class="attachment-thumbnail size-thumbnail" alt="" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /></a>
<a href='https://nerdpress.org/wp-content/uploads/2012/06/opengraph-module-silverstripe.png'><img decoding="async" width="150" height="150" src="https://nerdpress.org/wp-content/uploads/2012/06/opengraph-module-silverstripe-150x150.png" class="attachment-thumbnail size-thumbnail" alt="" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /></a>
</p>
<p>You should further add a default 200x200px image in your config:</p>
<pre class="brush: php; title: ; notranslate">OpenGraphPageExtension::$default_image = '/themes/myTheme/images/og_image.png';</pre>
<p>and add the opengraph namespace var in your html tag:</p>
<pre class="brush: xml; title: ; notranslate">&lt;html lang=&quot;en&quot; $OGNS&gt;</pre>
<p>Thats basically it, wow!</p>
<p>But of course you have to do some finetuning to represent your content best.<br />
So these questions you should ask yourself for each site where you would like to implement the metatags:</p>
<p><strong>Why should you use opengraph metatags?</strong><br />
To have control over the content of the sharer snippets.</p>
<p><strong>Where should you use opengraph metatags?</strong><br />
Where you can control / predict the content.<br />
Its not always a good idea to preselect the image.<br />
F.E when you have RichText HTML Field where the Content Manager can insert images. Then those images might be good to be shared.<br />
But with a preselected image via the og:image tag, the facebook share box will <strong>not</strong> list the other images.<br />
So on some pagetypes it might be better to not use the og tags and let the facebook parser do its <del datetime="2012-06-14T15:02:22+00:00">dirty</del> work.<br />
This you can achieve with overwriting the getOGType function in your pagetype:</p>
<pre class="brush: php; title: ; notranslate">
NonOGPage extends Page
{
    function getOGType() {
        return null;
    }
}
</pre>
<p>(thanx <a href="https://github.com/tractorcow">Damian</a>)</p>
<p><strong>How should you use it?</strong><br />
Treat your content right. So if you have a structured page type, think of which content fits and overwrite the resp. function of the module to serve the content you would like to see.<br />
F.E. if you have multiple images and you want the user to choose from while in the share dialog then do something like that:</p>
<pre class="brush: php; title: ; notranslate">
PageWithImages extends Page {
     function OGImage() {
        $imgs = array();
        if ($this-&gt;Images()) {
            $images = $this-&gt;Images();

            foreach ($images as $value) {
                $og_img = $value-&gt;Thumb()-&gt;CroppedImage(200, 200);
                $imgs&#x5B;] = $og_img-&gt;Url;
            }
        }
        if(empty($imgs)){
            $imgs&#x5B;] = Director::absoluteURL(OpenGraphPageExtension::$default_image);
        }
        return $imgs;
    }
}
</pre>
<p><strong>Who uses the opengraph metatags?</strong><br />
&#8211; Facebook of course.<br />
&#8211; Google+ seems	to prefer schema.org annotation but uses opengraph as fallback and then meta tags and then content.<br />
&#8211; Pinterest also seems to use it, partly.<br />
Here is a interesting discussion about it:<br />
<a href="http://stackoverflow.com/questions/6536213/are-there-tags-to-specify-the-google-1-story-format-in-google-like-og-meta-for">http://stackoverflow.com/questions/6536213/are-there-tags-to-specify-the-google-1-story-format-in-google-like-og-meta-for</a><br />
&#8211; and probably some more&#8230;</p>
<p>And at last here is the facebook <a href="http://developers.facebook.com/tools/debug">debug tool</a> to check your opengraph contents.</p>The post <a href="https://nerdpress.org/2012/06/14/opengraph-metatags-in-silverstripe/">Opengraph MetaTags in SilverStripe</a> first appeared on <a href="https://nerdpress.org">Nerdpress.org</a>.]]></content:encoded>
					
					<wfw:commentRss>https://nerdpress.org/2012/06/14/opengraph-metatags-in-silverstripe/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
	</channel>
</rss>
