Required meta tag missing (twitter:title) but already exist


#1

Hi there,

For some obscure reasons, twitter card validator say me that twitter:title meta tag is missing, but it’s in my html source as you can see ( nothing in the body section is normal )

    <!doctype html>
        <html lang="fr">
            <head>
	        <meta charset="utf-8">
                <meta name="twitter:card" content="summary_large_image" />
	        <meta name="twitter:site" content="<?=$site?>" />
	        <meta name="twitter:creator" content="<?=$creator?>" />
	        <meta name="twitter:title" content="<?=$title?>" />
	        <meta name="twitter:description" content="<?=$content?>" />
	        <meta name="twitter:image" content="<?=$path?>"/>
             </head>
             <body>
             </body>
         </html>

The only clue i have is when i fill twitter:title meta tag with plain text value like

<meta name="twitter:title" content="Here is my title" />

it works like a charm.
All others var works… any ideas guys ?

Thanks


#2

What value is your code setting $title to? Does that variable get rendered anywhere else in your page successfully?


#3

Value is simple string without special characters.
I changed variable’s name. Now it’s $lib and it works.

what it’s the reason ?


#4

I couldn’t say, perhaps the PHP framework you were using treated $title as a special case?


#5

i don’t think so but now it works for twitter card summary_large_image.
But i’m again in trouble for gallery twitter card.

Validator says

ERROR: Required meta tag missing (twitter:image2)
ERROR: Required meta tag missing (twitter:image1)
ERROR: Required meta tag missing (twitter:image0)
ERROR: Required meta tag missing (twitter:image3)

And guess what ? my image meta tag are present… I’m pretty sure that images path are because twitter card summary_large_image works with same url.

here is my snippet

<meta name="twitter:card" content="gallery" />
<meta name="twitter:site" content="<?=$site?>" />
<meta name="twitter:creator" content="<?=$creator?>" />
<meta name="twitter:title" content="<?=$lib?>">
<meta name="twitter:description" content="<?=$content?>">
<meta name="twitter:url" content="<?=$url?>" />
<?
    $count = 0;
    while($db = $idReq -> fetch(PDO::FETCH_ASSOC)){
        $path = "myimagepathfrom".$db;
        ?>
          <meta name="twitter:image<?=$count?>" content="<?=$path?>">   
        <?
        $count++
    }
?>

Any ideas ?