Reputation: 1388
I am running some functions on my controller to come up with a custom meta tag url that is then taken and used on the opengraph image tag for facebook. This image gets put in a variable, that then gets displayed on a url used for scraping on facebook. I got it working the right way and now the linter comes back at me with this error.
Object at URL 'http://mypage.org/pages/post.html?PostID=9192&prog=' of type 'website' is invalid because the given value '' for property 'og:image:url' could not be parsed as type 'url'.
How is that not a valid url? I can take the link and put it in my browser and it comes up just fine. I notice as well when I go down to see the scraped url it gives me back this..
<meta property="og:image" content="<img src='http://www.mypage.org/images/post_images/4121.jpg' />">
Looks like it takes my < and />, makes them into hex..why would the scraper do this? Btw here is the code from my controller.
$img = strstr($img, '<img src=');
$substring = substr($img, 0, strpos($img, "/>"));
$img = $substring . "/>";
What this code does is I take the code before the to the end of the url making a full <img src = "" />
url. Any and all help is very much appreciated.
Upvotes: 1
Views: 26757
Reputation: 31870
You shouldn't embed the HTML tag into the content of the meta tag. Try this format instead:
<meta property="og:image" content="http://www.mypage.org/images/post_images/4121.jpg">
Upvotes: 12
Reputation: 111
The content of your meta property should be the URL for the image, not a DOM element. Replace your og:image meta property by this one and it should work:
<meta property="og:image" content="http://www.mypage.org/images/post_images/4121.jpg">
Upvotes: 4