structured-data / linter

Structured Data linter
The Unlicense
85 stars 17 forks source link

Some ogp.me tags are not working #57

Closed dittnamn closed 4 years ago

dittnamn commented 4 years ago

Hello, I tried using the linter and when using the tags og:image:alt or og:locale:alternate, it stops without checking the rest of the code. The tags are correct according to the ogp.me website.

Example error message: error NoMethodError: undefined method 'property?' for #<RDF::URI:0x5931c URI:http://ogp.me/ns#image:alt> Did you mean? subProperty

Example codes that fail (copied from the ogp.me website):

<meta property="og:image" content="http://example.com/ogp.jpg" />
<meta property="og:image:secure_url" content="https://secure.example.com/ogp.jpg" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="400" />
<meta property="og:image:height" content="300" />
<meta property="og:image:alt" content="A shiny red apple with a bite taken out" />
<meta property="og:audio" content="http://example.com/bond/theme.mp3" />
<meta property="og:description" content="Sean Connery found fame and fortune as the suave, sophisticated British agent, James Bond." />
<meta property="og:determiner" content="the" />
<meta property="og:locale" content="en_GB" />
<meta property="og:locale:alternate" content="fr_FR" />
<meta property="og:locale:alternate" content="es_ES" />
<meta property="og:site_name" content="IMDb" />
<meta property="og:video" content="http://example.com/bond/trailer.swf" />
gkellogg commented 4 years ago

The validation is done based on our internal vocabulary representation for OGP, which you can see here. You'll note that it doesn't include og:image:alt. The vocabulary is built automatically from http://ogp.me/ns/ogp.me.ttl, which interestingly, also doesn't include that term. I could add build instructions to add it, but I'm loath to have to maintain the vocabulary manually. Ideally, Facebook would ensure that their vocabulary description in Turtle matches the documentation.

However, you shouldn't get an undefined method 'property?' error. It may complain that you're using an undefined property, but shouldn't error out.

dittnamn commented 4 years ago

Alright, I see. I tried to see if there's any way to report that to the OGP team, but the Facebook page seems inactive, the mailing list is removed and the Github project has been archived. It looks like Facebook has abandoned the project, as they're not even using it themselves anymore.

I think it might be enough if the error could be changed to a warning, so that the rest of the code could be checked as well.

gkellogg commented 4 years ago

I went ahead and added 3 missing terms to the OGP vocabulary; doesn't look like it's going to need much further maintenance.

dittnamn commented 4 years ago

Great, that was quick. I do still get a warning with the same code though: property http://ogp.me/ns#image:alt: Object "A shiny red apple with a bite taken out" not compatible with range (ogc:url)

Could it be that og:image:alt should be in the range ogc:string instead of ogc:url?

gkellogg commented 4 years ago

Sorry, I got the range of og:image:alt wrong, I'll get another update out shortly.

gkellogg commented 4 years ago

Okay, you should see version 3.8.3 up shortly which has a fix.