content attribute with URLs in meta tags

Discussion about HTML and XHTML related issues.
Post Reply
TomHTML
Rank II - Novice
Rank II - Novice
Posts: 42
Joined: Sun Feb 04, 2018 10:19 am

content attribute with URLs in meta tags

Post by TomHTML » Mon Mar 25, 2019 4:31 pm

The Yandex structured data checker (https://webmaster.yandex.com/tools/microtest/) reported a surprising error to me:
ERROR: The 'content' property of a meta tag can't contain a URL
It was in reference to this block:

Code: Select all

<!DOCTYPE html>
<html lang=en-us prefix="og: http://ogp.me/ns#" itemscope itemtype="https://schema.org/WebPage">

<head typeof=http://ogp.me/ns#>
	<title>ACME</title>
	<base href="https://acme/">
	<meta charset=utf-8>
	<meta itemprop=description content="Acme company makes things.">
	<meta itemprop=image content="images/acme-logo.jpg">
	<meta itemprop=name content="ACME">
	<meta itemprop=thumbnailUrl content="images/acme-logo.jpg">
	<meta itemprop=url content="images/acme-logo.jpg">
By process of elimination, I discovered it was upset with the itemprop=thumbnailUrl and itemprop=url content attributes. Neither the W3C validator nor the CSS HTML validator is concerned about this, and the content attribute is used for URLs within social media meta tags all the time.

Is the Yandex linter mistaken, or has it identified a problem in my HTML? What's going on here?

Many thanks,
Tom

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3407
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: content attribute with URLs in meta tags

Post by Albert Wiersch » Tue Mar 26, 2019 9:57 am

Hello Tom,

These links may be helpful:
https://schema.org/WebPage
https://yandex.com/support/webmaster/sc ... a-org.html

I think it wants you to use the "link" element for URLs instead.

This seems to work:

Code: Select all

	<meta itemprop=description content="Acme company makes things.">
	<link itemprop=image href="images/acme-logo.jpg">
	<meta itemprop=name content="ACME">
	<link itemprop=thumbnailUrl href="images/acme-logo.jpg">
	<link itemprop=url href="images/acme-logo.jpg">
Image
Albert Wiersch

TomHTML
Rank II - Novice
Rank II - Novice
Posts: 42
Joined: Sun Feb 04, 2018 10:19 am

Re: content attribute with URLs in meta tags

Post by TomHTML » Tue Mar 26, 2019 11:20 am

It's happy with <meta itemprop=image content="images/acme-logo.jpg"> though. That's what puzzles me.

TomHTML
Rank II - Novice
Rank II - Novice
Posts: 42
Joined: Sun Feb 04, 2018 10:19 am

Re: content attribute with URLs in meta tags

Post by TomHTML » Tue Mar 26, 2019 1:02 pm

I've decided to abstract all of that data to a proper application/ld+json script, which resolves all of the issues.

Post Reply