Facebook OpenGraph Meta Tags

Permalink Browser Info Environment
How do access a post title from within the wordpress_entires block controller? I would like to add Facebook OpenGraph meta tags.

public function on_page_view() {
         // this puts your string to output in
         // the Loader::element('header_required')
         // class
         $this->addHeaderItem("<meta property=\"og:url\" content=\"".$this->getCurrentPageURL()."\"/>\n");
         $this->addHeaderItem("<meta property=\"og:title\" content=\"\"/>\n");
      }

Type: Discussion
Status: New
BrianJM
View Replies:
elyon replied on at Permalink Reply
elyon
I would like to sit down and perform another round of improvements on the add-on.

Can we add this into the add-on by default? Is there anything more we would need to better support Facebook integration?
elyon replied on at Permalink Reply
elyon
Ah, there's going to be a problem with this approach.

This won't work with AJAX, because adding a header item needs to happen while the page is generated. An AJAX request will run (and find the post title) after the page has been loaded.

However, I have a script that checks the user agent for search engines, and switches to cURL automatically.

If we can make sure that we have the user agent for Facebook, I can make sure we trigger the cURL switch, and then I can add these tags (do we only need these two?) into the add-on by default.
BrianJM replied on at Permalink Reply
BrianJM
The user agent for Facebook is currently "facebookexternalhit/1.1 (+https://www.facebook.com/externalhit_uatext.php)".

Take a look at the Open Graph Protocol reference (https://developers.facebook.com/docs/opengraphprotocol/). There are a number of applicable meta tags that are relevant.

For my purposes, the following are desired (there are a number of others that are applicable to Wordpress):
- og:title
- og:url (pretty url)
- og:image
- og:site_name
- og:description

My understanding is that LinkedIn also used the Open Graph Protocol. The user agent for LinkedIn is "LinkedInBot/1.0 (compatible; Mozilla/5.0; Jakarta Commons-HttpClient/3.1 +http://www.linkedin.com)".
elyon replied on at Permalink Reply
elyon
Thank you! I'll see if I can add these in by default :)
BrianJM replied on at Permalink Reply
BrianJM
Thanks for the update. Do you have any idea when this may be complete? I ask because my manager pings me weekly about this, and I would like to install a single update to address this simultaneously with my other support requests that have been resolved (because I have made several customizations to the package).
BrianJM replied on at Permalink Reply
BrianJM
Looking forward to this new feature... :)

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.