Twitter-Card Meta Tag Issue

99封情书 提交于 2021-02-10 06:16:30

问题


URL in question: https://www.halleonard.com/viewpressreleasedetail.action?releaseid=10261

When you view the source in a browser and in Developer Tools, you can see all of the meta tags for Open Graph and Twitter. I have checked the Facebook Debugger and, aside from a few canonical issues, I'm fairly happy with the results.

I also plugged the above URL into a third-party Open Graph Debugger: http://debug.iframely.com/ and all of the tags for Open Graph, Twitter and even other all come back positive.

Why is is that Twitter's Card Validator is coming back with a

INFO:  Page fetched successfully
INFO:  9 metatags were found
ERROR: No card found (Card error)

Any insight on how I get Twitter to display properly?


回答1:


I think you may either be blocking or redirecting the Twitterbot agent.

I faked a Twitterbot agent with curl:

curl -A 'Twitterbot' https://www.halleonard.com/viewpressreleasedetail.action?releaseid=10261 -o ~/Desktop/what-twitterbot-sees.html

And this is what your server returns:

As you can see there are 10 meta tags (if you exclude the <meta charset> one) which is what the card validator indicates and there are no <meta name="twitter:*"> tags at all.

You can reproduce with your browser if you can set a custom user agent string. This is possible with Google Chrome:

I'm pretty sure there's some sort of redirection rule going on either at your web server level or in your application code.


According to developer.twitter.com, the user agent string I have used is correct:

Twitter uses the User-Agent of Twitterbot (with version, such as Twitterbot/1.0)




回答2:


I checked your source code with w3c validator.

https://validator.w3.org/

it seems that google tag manager is not installed properly: you have to move the google tag manager (noscript) (line 10:13) on top of the body section and absolutely remove it from head section.

You can find here some information https://support.google.com/tagmanager/answer/6103696?hl=en

and also (more specific) in your tag manager page (like this attached)




回答3:


The error is coming because of the twitter:card type you have selected. You forgot to add the twitter:image content. These both should be added.

<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="ADD IMAGE URL">

Reference Link



来源:https://stackoverflow.com/questions/57480011/twitter-card-meta-tag-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!