Question

What I would like to do is take the value of the href and assign it to the email property. Right now, I have something like this <a href="mailto:jane-doe@xyz.edu" itemprop="email">email</a> The result is email="email"

The schema.org documentation has an example that uses the following syntax <a href="mailto:jane-doe@xyz.edu" itemprop="email">jane-doe@xyz.edu</a> The result is email=jane-doe@xyz.edu

Do I have to spell out my email address in order to mark it up using microdata?

I know that some properties such as URL actually grab the href value instead of the text surrounded by the HTML tag. Is this possible to configure for the email property?

Was it helpful?

Solution

Schema.org’s email property expects Text as value.

It’s odd. In my opinion it should take URL instead, or at least allow boths ways ("Text or URL", as it’s the case with the menu property, too).
I can only guess that they chose Text because some publishers don’t want to specify their real email address for spam prevention reasons (for example, "john -at- example dot org" isn’t an URL, of course; this is also used as an example in Organization: <span itemprop="email">secretariat(at)google.org</span>), or because some would forget to add the protocol mailto:, but both of these "issues" aren’t reasons not to allow URL in addition.

Here’s a related thread in the public-vocabs mailing list:
Expected type(s) for email should include URL

If you don’t want to have the email address visible on the page, and you want to follow the current definition by using Text, you could use the meta element as an ugly workaround:

<p>
  <a href="mailto:john@example.com">email</a>
  <meta itemprop="email" content="john@example.com" />
  <!-- the value is not an URL but text -->
</p>

Side note:

Every conforming Microdata parser must extract "email: mailto:john@example.com" for this markup:

<a href="mailto:john@example.com" itemprop="email">email</a>

As the email property is used on a, the value is the href content and not the element content.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top