Reputation: 43
Having setup metatags for sharable pages via a heroku-hosted react web app. I've noticed that Twitter cards are not being properly presented, despite page source correctly presenting twitter and og meta data.
Given the below - Is there anything I haven't considered yet?
Javascript: I have tested with javascript disabled, and the site still renders correctly, with correct meta tags
Image Size: Is within defined limits - 434px X 650px, 94KB
Hosting: Hosted on Herokuapp, the URL is still using the herokuapp domain (hasn't been switched to a production url) expressFullURL : https://project.herokuapp.com/share/[ID]
Image Hosting: Images are referencing AWS S3 buckets in the url https://media.project.aws/[etc]
Robots: The site does not have a robots.txt file
Below, is the head meta content:
twitter.image
URL is dynamically loaded in
twitter.url
, which is also dynamic using express to generate the full URL (http://project.com/share/page/1234)
<!-- basic meta -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<meta content="text/html; charset=UTF-8" name="Content-Type" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- content meta -->
<meta name="description" content="description content" />
<meta name="copyright" content="Copyright 2019" />
<!-- Twitter meta -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:site" content="@handle">
<meta property="twitter:image" content="${image.url}">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="${expressFullURL}">
<meta property="twitter:title" content="Title">
<meta property="twitter:description" content="description content">
<!-- opengraph data -->
<meta property="og:title" content="Title" />
<meta property="og:description" content="description content" />
<meta property="og:url" content="${expressFullURL}" />
<meta property="og:image" content="${image.url}" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="Site Name" />
Using https://cards-dev.twitter.com/validator the response is:
INFO: Page fetched successfully
WARN: No metatags found
Meta is correct on page, so can't understand why no metatags can be found
Upvotes: 4
Views: 3276
Reputation: 13057
I made a couple of observations that I'd like to document as an answer here:
<meta charset="utf-8">
tag is required.twitter:image
tag needs a full HTTPS URL, like https://host.com/some/image.jpg
.A minimum working example is:
<html>
<head>
<meta charset="utf-8">
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="@username"/>
<meta name="twitter:title" content="A title"/>
<meta name="twitter:description" content="A description."/>
<meta name="twitter:image" content="https://host.com/some/image.jpg"/>
</head>
<body>
</body>
</html>
Upvotes: 0
Reputation: 1
I had a similar situation, but seem to have it working. I kept an eye on the Heroku logs heroku logs --tail
while clicking the validator preview button. Turns out I was getting a 500 error from my app, because of the format of the request from the validator. Might be worth a check.
Upvotes: 0