Skip to content

Instantly share code, notes, and snippets.

@jerclarke
Created June 15, 2015 12:41
Show Gist options
  • Save jerclarke/6d5b5bd8179499d12dcc to your computer and use it in GitHub Desktop.
Save jerclarke/6d5b5bd8179499d12dcc to your computer and use it in GitHub Desktop.
WTF Facebook OG tags that don't work and the meta tags that do
<?php
/**
* Insert site_name meta tag
*/
$site_name = gv_get_site_name();
$site_name_escaped = esc_attr($site_name);
$output .= "<meta property=\"og:site_name\" content=\"$site_name_escaped\" />\n";
// WTF: Also add meta name=cre as site name because NYT uses it and facebook seems to pick it up from them despite it not being in the docs
$output .= "<meta name='cre' content='$site_name_escaped' />\n";
///////
/**
* Insert Author meta tag ONLY if it was set (many screens have no author)
*/
if ($author_name) :
// DISABLED: Caused errors in FB parser which only wants FB profile URLs that we dont' have
//$output .= "<meta property=\"article:author\" content=\"$author_name\" />\n";
// WTF: Also add meta name=byl as "byline" because NYT uses it and facebook seems to pick it up despite it not being in the docs
$byline = "$author_name";
$output .= "<meta name='byl' content='$byline' />\n";
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment