1
\$\begingroup\$

I'm building a news aggregator website. This is my current schema structure for a single news article. There can be more than one article per page. I'm trying to have every possible piece of data structured. Am I missing something? How can this structure be schema.org-optimized for a news article post?

<article itemscope itemtype="http://schema.org/NewsArticle">
    <meta itemprop="inLanguage" content="es-419" />
    <meta itemprop="dateModified" content="2015-03-02T19:03Z" />
    <meta itemprop="keywords" content="correa, obama, whitehouse" />
    <meta itemprop="commentCount" content="41" />
    <meta itemprop="description" content="Excerpt of the news text goes here..." />
    <meta itemprop="isBasedOnUrl" content="http://eluniverso.com/2015/03/01/noticia3.html" />

    <h2 itemprop="headline">
        <a href="/noticias/2015/02/03/headline-goes-here" itemprop="url">Headline goes here</a>
    </h2>

    <time datetime="2015-03-02T17:43Z" itemprop="datePublished">Mar 2</time>
    <p itemprop="articleBody">Complete article goes here. Two or three lines perhaps. Maybe more.</p>
    <span class="tag" itemprop="articleSection">politics</span>
    <span class="length" itemprop="wordCount">67</span>

    <img src="uploads/image_4.jpg" itemprop="thumbnailUrl">

    <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
        <meta itemprop="bestRating" content="5">
        <meta itemprop="worstRating" content="1">
        <span itemprop="ratingValue">4.1</span>/5 based on <span itemprop="reviewCount">249</span> votes
    </div>

    <span class="source" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
        <meta itemprop="logo" content="/logos/eluniverso.png" />
        <span itemprop="name">
            <a href="http://eluniverso.com/2015/03/01/example1.html">El Universo</a>
        </span>
    </span>
</article>

<ul itemscope itemtype="http://schema.org/WebPage">
    <li><a href="/noticias/2015/02/01/original-breaking-news.html" itemprop="relatedLink">Related News 1</a></li>
    <li><a href="/noticias/2015/02/02/more-data.html" itemprop="relatedLink">Related News 2</a></li>
    <li><a href="/noticias/2015/02/03/other-thing-that-happened.html" itemprop="relatedLink">Related News 3</a></li>
</ul>
\$\endgroup\$

migrated from stackoverflow.com May 15 '15 at 15:40

This question came from our site for professional and enthusiast programmers.

1
\$\begingroup\$

HTML5+Microdata

  • In case of meta/link:

    If the value is a URI, you have to use link instead of meta.

    So this

    <meta itemprop="isBasedOnUrl" content="http://eluniverso.com/2015/03/01/noticia3.html" />
    

    should be

    <link itemprop="isBasedOnUrl" href="http://eluniverso.com/2015/03/01/noticia3.html" />
    

    and this

    <meta itemprop="logo" content="/logos/eluniverso.png" />
    

    should be

    <link itemprop="logo" href="/logos/eluniverso.png" />
    
  • Your thumbnail img is missing the required alt attribute.

Schema.org

  • In addition to (or instead of) headline it can be beneficial to provide name. The headline property can only be used for CreativeWork (and sub-types), while the name property is defined for every type. It’s likely that many consumers look for and make use of name but not headline.

    You could provide both properties, separated with a space, on the same element, i.e.,

    <h2 itemprop="headline name">
    
  • If the link in Organization is about this organization, you might want to use the url property.

  • The WebPage could reference the NewsArticle via the mainEntity property (if the page is only about a single news article; otherwise the NewsArticle could reference its WebPage with the reverse mainEntityOfPage property).

    While you could use Microdata’s itemref attribute to reference it without changing the markup structure, it’s not necessary if markup changes are possible. You could specify WebPage on a container div (or the body, if it’s the only/current web page), e.g.:

    <div itemscope itemtype="http://schema.org/WebPage">
    
      <!-- properties about the web page, i.e., the web page’s URL -->
    
      <article itemprop="mainEntity" itemscope itemtype="http://schema.org/NewsArticle">
    
        <!-- properties about the news article, i.e., the news article’s URL -->
    
      </article>
    
      <ul>
        <li><a itemprop="relatedLink" href="/noticias/2015/02/01/original-breaking-news.html">Related News 1</a></li>
        <li><a itemprop="relatedLink" href="/noticias/2015/02/02/more-data.html">Related News 2</a></li>
        <li><a itemprop="relatedLink" href="/noticias/2015/02/03/other-thing-that-happened.html">Related News 3</a></li>
      </ul>
    
    </div>
    
\$\endgroup\$
  • \$\begingroup\$ Great feedback! Yes, the link in Organization is from this organization, I can change it to <link href="http://eluniverso.com"> - but then where can I put the original URI content? (This is a news aggregator service, I have to specify where the original content is) \$\endgroup\$ – Andres SK May 15 '15 at 17:22
  • \$\begingroup\$ Also, one last question, didn't even know how to structure it in my original post: How can I specify a list of related links inside the NewsArticle structure? Or should I make a separate <div> sibling with a WebPage schema? \$\endgroup\$ – Andres SK May 15 '15 at 17:31
  • 1
    \$\begingroup\$ @andufo: Ah, I misunderstood the link in Organization. Yes, you could add a link element with url property, pointing to the organization’s home page (but you don’t have to). -- How to reference the original URL of the article, that’s a good question … the Organization item would not be the correct place for this, as this is directly related to the NewsArticle, not the publisher of it. Actually, it would be the url of the NewsArticle, but I guess there’s a conflict of interest as you want to provide your own URL here. Maybe sameAs? Not sure. \$\endgroup\$ – unor May 15 '15 at 17:38
  • \$\begingroup\$ got it! for my 2nd (and last question) I edited the original code by adding that WebPage structure separated from the NewsArticle structure. Is that alright? Any way to actually put WebPage inside of NewsArticle? \$\endgroup\$ – Andres SK May 15 '15 at 17:44
  • 1
    \$\begingroup\$ duly noted :) sorry this is my 1st post here, i was mainly a SO user before. I'll remove it asap, thanks again for everything! \$\endgroup\$ – Andres SK May 15 '15 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.