Twitter Card Image not loading '- twitter:image' metatag may be restricted

594 Views Asked by At

I have a problem with twitter card integration on a friend's Wordpress site. In the site's Wordpress theme I added the twitter meta tags as required for a Twitter card image. This is the tag I added to the header.php theme file:

<meta name="twitter:image" value="https://myurl.de/twitter-card-shot.webp" />

I made sure that the website robots.txt file would allow the Twitterbot to crawl the site, this is the content of robots.txt

User-Agent: *
Disallow:

User-agent: Twitterbot
Allow: /

I then used the Twitter Card Validator to make sure everything was working and I got the following response and error

INFO:  Page fetched successfully
INFO:  26 metatags were found
INFO:  twitter:card = summary_large_image tag found
INFO:  Card loaded successfully
WARN:  The image URL https://x8yxxx.n3cdn1.secureserver.net/twitter-card-shot.webp specified by the 'twitter:image' metatag may be restricted by the site's robots.txt file, which will prevent Twitter from fetching it.

I've noticed that for some reason the hosting that my friend has changes the urls from the domain "myurl.de" to "https://x8yxxx.n3cdn1.secureserver.net/" when inspecting the source code. Perhaps this is the reason the card validator is not being shown and an error is being displayed? I can deeplink to both https://x8yxxx.n3cdn1.secureserver.net/twitter-card-shot.webp and https://myurl.de/twitter-card-shot.webp and the image is shown in the browser. I also noticed that the file permissions are fine on the server. I also tried using another url on the twitter meta tag value inside the Wordpress content folder, something like so

<meta name="twitter:image" value="https://myurl.de/wp-content/uploads/2023/05/twitter-card-shot.webp" />

This also didn't work. Is there something I am doing wrong? Is the hosting changing the href references in the source code the reason the card isn't being displayed. I'm not used to working with shared hosting and Wordpress hosting so I am unsure if this is a code or hosting issue. Any information or guidance would be appreciated.

0

There are 0 best solutions below