content attribute with URLs in meta tags

For general web development questions that are not specifically related to CSS HTML Validator. This includes (but is not limited to) general HTML, CSS, Accessibility, JavaScript, and SEO questions.
TomHTML
Rank III - Intermediate
Posts: 75
Joined: Sun Feb 04, 2018 10:19 am

content attribute with URLs in meta tags

Post by TomHTML »

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
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: content attribute with URLs in meta tags

Post by Albert Wiersch »

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">
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
TomHTML
Rank III - Intermediate
Posts: 75
Joined: Sun Feb 04, 2018 10:19 am

Re: content attribute with URLs in meta tags

Post by TomHTML »

It's happy with <meta itemprop=image content="images/acme-logo.jpg"> though. That's what puzzles me.
TomHTML
Rank III - Intermediate
Posts: 75
Joined: Sun Feb 04, 2018 10:19 am

Re: content attribute with URLs in meta tags

Post by TomHTML »

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