Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.75k stars 886 forks source link

Add Article or BlogPosting schema markup to posts #10532

Closed galbaras closed 5 years ago

galbaras commented 6 years ago

Is your feature request related to a problem? Please describe.

Google is now recommending having datePublished and dateModified structured data. See here.

Describe the solution you'd like

There are already plugins adding LD+JSON Article markup to posts (like Schema and Markup), but Yoast SEO isn't one of them, so maybe it's time to integrate this feature.

why you think the feature request is something we should consider for the Yoast SEO plugins?

It creates a more complete solution and an easy win.

Additional context

benvaassen commented 6 years ago

Thank you for opening a feature request.

I've labeled this issue needs decision which means our product managers will assess your request.

jonoalderson commented 6 years ago

I think this makes sense for us to add.

We should add a flavour of the following to all post posts (not custom posts) by default, but also allow disabling/filtering by post-type or individual post basis.

We already have all of this in OG tags, or otherwise accessible+defined vars.

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "NewsArticle",
  "mainEntityOfPage": {
    "@id": "https://www.example.com/page"
  },
  "headline": "Article headline",
  "image": [
    "https://example.com/photos/1x1/photo.jpg",
    "https://example.com/photos/4x3/photo.jpg",
    "https://example.com/photos/16x9/photo.jpg"
   ],
  "datePublished": "2015-02-05T08:00:00+08:00",
  "dateModified": "2015-02-05T09:20:00+08:00",
  "author": {
    "@id": "https://www.example.com/example-person-bio/#person"
  },
  "publisher": {
    "@id": "https://www.example.com/#organization"
  },  
"description": "A most wonderful article"
}
</script>

This assumes that the organization (or person), the WebPage, and the post author are defined elsewhere in the graph - see "Base Script" and "When a page has an author" in https://docs.google.com/document/d/14ITkylzQDQVOqM_pu8ZgzeKJD8VOJkPokrWo02FfElo/edit?usp=sharing

jonoalderson commented 6 years ago

*We should do article on post(s) rather than newsArticle by default.

jonoalderson commented 5 years ago

On hold pending a new, under-development approach to JSON-LD in the plugin.

tyrann0us commented 5 years ago

@jono-alderson

On hold pending a new, under-development approach to JSON-LD in the plugin.

Do you have an issue/PR link for me to follow? Couldn't find anything that looks related. Thanks!

jonoalderson commented 5 years ago

@tyrann0us This is a work-in-progress spec, which will include the support for this: https://docs.google.com/document/d/14ITkylzQDQVOqM_pu8ZgzeKJD8VOJkPokrWo02FfElo/edit?usp=sharing

mayada-ibrahim commented 5 years ago

Please inform the customer of conversation # 445243 when this conversation has been closed.

galbaras commented 5 years ago

Is this going ahead any time soon? It seems really important for a WordPress SEO plugin and isn't very difficult to implement.

While you're at it, remove rel="publisher", because Google is retiring Google Plus (not that this affected SEO in the last couple of years anyway, it's just a bit of code cleanup).

jonoalderson commented 5 years ago

Whilst parts of this are simple, it needs to integrate cleanly and consistently with all of the different page/content types which are possible in our setup. That requires some careful thinking, planning, and some tweaks elsewhere. We're working towards this, and much more, but there are complex foundations to lay (especially considering the role/impact of Gutenberg blocks, etc).

jonoalderson commented 5 years ago

Depends on https://github.com/Yoast/wordpress-seo/issues/12461

inetbiz commented 5 years ago

@jono-alderson in your example: This should be an itemPage not a Webpage. See https://schema.org/ItemPage

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "NewsArticle",
  "mainEntityOfPage": {
    "@type": "ItemPage",
    "@id": "https://google.com/article"
  },
  "headline": "Article headline",
  "image": [
    "https://example.com/photos/1x1/photo.jpg",
    "https://example.com/photos/4x3/photo.jpg",
    "https://example.com/photos/16x9/photo.jpg"
   ],
  "datePublished": "2015-02-05T08:00:00+08:00",
  "dateModified": "2015-02-05T09:20:00+08:00",
  "author": {
    "@id": "https://www.example.com/example-person-bio/#person"
  },
  "publisher": {
    "@id": "https://www.example.com/#organization"
  },  
 "backstory": "A most wonderful article"
 "articlebody": "~~~",
 "wordCount": "xxx",
 "timeRequired": "xxx"
}
</script>

backstory: wp excerpt articlebody: content timeRequired: https://gist.github.com/mynameispj/3170442

inetbiz commented 5 years ago

@jono-alderson also agree with gutenberg blocks. If The Gutenberg project would simply add an item href or ID it could be referenced in json+ld IMHO

jonoalderson commented 5 years ago

Hmm. I agree conceptually, but, the graph structure we're designing assumes the 'WebPage' as the center of our graph (it uses the URL of the page as the ID, which forms the source/destination of all of the other nodes on the page). I'm not sure that drilling down to the more specific 'ItemPage' adds much value, and it does so at the cost of significantly complicating how we're trying to represent the page for Google/etc.

For now, I'd like us to proceed with WebPage, but I'll digest the ItemPage considerations in the background and might adjust our approach at a later time.

inetbiz commented 5 years ago

@jono-alderson also for images, imageobjects should be used with title, description, copyright, creator when going for news articles and articles. Image search is just as important to find articles. IMHO

jonoalderson commented 5 years ago

Agreed. However, with further consideration I'm going to park this for now - we need to refine this logic so that only 'news' articles get the NewsArticle schema, and everything else gets the BlogPosting schema. At the moment, we don't have a way to differentiate these safely reliably in WP native / Yoast SEO.

However, the Yoast SEO News extension does have such a distinction. So, I'm going to move this issue over there for now in order to get the ball rolling.

inetbiz commented 5 years ago

Well page templates would designate a BlogPosting or an Article would it not? Would that interfere with theming too much? And, you can add custom field types to wp media to grab pertinent information for copyright, publisher, et al.

As you know an article receives less changes and more objective whereas a blogposting is opinionated. Article type is more advantageous given that Google will display carousels say on a tag or category listitem page. see https://developers.google.com/search/docs/guides/mark-up-listings support content types ( subheading: guidelines )

jonoalderson commented 5 years ago

Yep, that makes sense conceptually, but, people don't use consistent labelling on their post types / content / templates. And, we don't want to add a ton of fields/options/settings if we can avoid it. We need to start from graceful defaults, then build up from there. That's why we're working on refining our underlying approach to Schema markup, and, then we'll revisit bolting this on/in :)

galbaras commented 5 years ago

Why not start by handling the simple stuff: blog post and page? That should get 80% of the job done with 20% of the effort, no?

inetbiz commented 5 years ago

@galbaras because it's just as simple to identify as an Article for rich snippets. Your strategy gets tens of thousands of blogs out of Google Rich Snippets. https://developers.google.com/search/docs/guides/mark-up-content

jonoalderson commented 5 years ago

Many sites use Posts for things which aren't blog posts, and Pages for things which aren't pages. We can't roll out a simple solution which works for 80% of users, but breaks for 20%.

Bear with us, we've some big stuff in the works.

galbaras commented 5 years ago

@jdevalk and @jono-alderson you've done a remarkable job on this so far, which is likely to have far-reaching impact on sites using Yoast SEO.

What's the direction for custom post types? For example, I have a site with a custom post type called "portfolio", which I actually use to display products.

Also, will you publish a document for developers on the various programming hooks in this new module?

jonoalderson commented 5 years ago

Thank you very much!

The good news is, we have an API and documentation which you can use to solve this on your own site - see https://developer.yoast.com/schema-documentation/api/. You should be able to adapt the type of the node representing the page, e.g., to product.

I'll close this ticket, now! :)