-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(open_graph): remove duplicate twitter card tags #3668
Conversation
please remove relevant lines in "test/scripts/helpers/open_graph.js". |
86316dd
to
b029921
Compare
result += meta('twitter:title', title); | ||
if (description) { | ||
result += meta('twitter:description', description, false); | ||
} | ||
|
||
if (images.length) { | ||
result += meta('twitter:image', images[0], false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
twitter:image
is deletable. Isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yoshinorin It seems like og:image
support multiple images while twitter:image
only support one image. The docs from twitter do not mention multiple images usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc is not exactly clear.
URL of image to use in the card. Images must be less than 5MB in size. JPG, PNG, WEBP and GIF formats are supported. Only the first frame of an animated GIF will be used. SVG is not supported.
"URL of image....Images must..."; image? images?
Anyway, the doc does mention twitter:image fallback to og:image, so I think it's redundant too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found following comments from twitter developers forum.
- https://twittercommunity.com/t/for-multiple-images-twitter-is-not-following-the-ogp-spec/15875
- https://twittercommunity.com/t/twitter-cards-i-have-a-problem-help-me/15320/98
- https://twittercommunity.com/t/wrong-image-appearing-in-twitter-cards-using-wordpress-seo-by-yoast-plugin/15747/10
According to comments. The twitter card use last og:image
if multiple og:image
tags exists. It's not following ogp specification.
They are very old comments (4~6 years ago). I could not find newer information. IMHO we should use twitter:image
if we can not find more information about this matter.
I will merge this if other opinion does not exist after wait a while.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to comments. The twitter card use last og:image if multiple og:image tags exists. It's not following ogp specification.
I figure most users would expect the first image, which is the current behavior of open_graph.js
. Let's keep twitter:image
for now.
* fix: remove duplicated twitter card tags * test(open_graph): add og:locale & remove twitter:title * test(open_graph): remove twitter:description & update item
What does it do?
Remove
twitter:title
andtwitter:description
which is duplicated withog:title
andog:description
According to the Twitter Card Docs:
SInce the value of
twitter:title
andtwitter:description
is the same asog:title
andog:description
, they can be removed.How to test
Pull request tasks