I've recently ran into an interesting problem : V3C Validator shows errors checking facebook meta tags for HTML5 doctype. Official facebook forum has no solution for this problem at the moment.
However there is one. See the PHP code below, code goes without explanation.
function is_facebook(){ if(!(stristr($_SERVER["HTTP_USER_AGENT"],'facebook') === FALSE)) return true; } <!DOCTYPE html> <html <?php if(is_facebook()){ echo 'xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/"';}> <head> <title>This Maybe It</title> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ /> <?php if(is_facebook()){ <meta property="og:title" content=" echo $mytitle;"/> <meta property="og:description" content=" echo $mydescription;"/> <meta property="og:type" content="website"/> <meta property="og:image" content="http://mysite.com/images/myimage.jpg"/> <meta property="og:url" content="http://mysite.com"/> <meta property="og:site_name" content="My Site"/> <meta property="fb:appid" content=" $my_app_id "/> }
Comments
Arkadiusz
This script dosnt work correctly Check this is
Line 5, Column 69: Internal encoding declaration named an unsupported chararacter encoding utf-8″.
Line 5, Column 69: Bad value ”Content-Type” for attribute http-equiv on element meta.
Line 5, Column 69: Attribute charset not allowed on element meta at this point.
monkey
I think the script works, it's the quotes that doesn't. Try retyping them manually.
You can check this website : http://idol-studio.md, if you open it's source codes - you'll see this exact line of code
and it's error free.