New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add schema.org markup #179

Closed
iagdotme opened this Issue Aug 20, 2013 · 16 comments

Comments

Projects
None yet
7 participants
@iagdotme

On a per post basis:
Choice of document type (dropdown menu): eg AboutPage, CheckoutPage, CollectionPage, ContactPage, ItemPage, MedicalWebPage, ProfilePage, SearchResultsPage (also ability to set default for all posts/pages/categories etc). This might be difficult to implement since it would involve adding to the tag.

@jdevalk

This comment has been minimized.

Show comment
Hide comment
@jdevalk

jdevalk Aug 20, 2013

Member

Actually very easy to do for Genesis based sites :)

Member

jdevalk commented Aug 20, 2013

Actually very easy to do for Genesis based sites :)

@iagdotme

This comment has been minimized.

Show comment
Hide comment
@iagdotme

iagdotme Aug 20, 2013

I am sure it is, I haven't used Genesis. I custom build my sites using Roots Theme. I suppose I could create my own function to add this feature to my theme, but I wondered whether this might be a useful feature for WordPress SEO? Or do you think this would best offered from a theme such as Genesis or a custom function?

I am sure it is, I haven't used Genesis. I custom build my sites using Roots Theme. I suppose I could create my own function to add this feature to my theme, but I wondered whether this might be a useful feature for WordPress SEO? Or do you think this would best offered from a theme such as Genesis or a custom function?

@defries

This comment has been minimized.

Show comment
Hide comment
@defries

defries Aug 20, 2013

Member

I know this doesn't help your specific use case, but there already is a solution for Genesis.

Member

defries commented Aug 20, 2013

I know this doesn't help your specific use case, but there already is a solution for Genesis.

@iagdotme

This comment has been minimized.

Show comment
Hide comment
@iagdotme

iagdotme Aug 20, 2013

@defries thanks, if you know of a solution that isn't just for Genesis I am all ears. I would rather avoid a plugin, but that is only because I am a complete control freak! ;-)

It sounds like the opinion so far is that this is best done by the theme. However, for less techie people it would be good if there was a solution baked into WordPress SEO or an addon that offered this. schema.org apparently is the future...

@defries thanks, if you know of a solution that isn't just for Genesis I am all ears. I would rather avoid a plugin, but that is only because I am a complete control freak! ;-)

It sounds like the opinion so far is that this is best done by the theme. However, for less techie people it would be good if there was a solution baked into WordPress SEO or an addon that offered this. schema.org apparently is the future...

@iagdotme

This comment has been minimized.

Show comment
Hide comment
@iagdotme

iagdotme Aug 20, 2013

@Yoast I should have clarified a little further, there are other things you can do to add schema markup to the head in addition to the title tag which WordPress SEO could add. For example the canonical link and meta description tags.

There is an interesting article by Felix Arntz with a function that modifies these tags using the WPSEO_Frontend class:

<?php 
function yourtheme_meta_schema()
{
    if( class_exists( 'WPSEO_Frontend' ) )
    {
        global $wpseo_front;

        $canonical = $wpseo_front->canonical( false );
        echo '<link itemprop="url" href="' . esc_url( $canonical, null, 'other' ) . '" />' . "\n";
        $metadesc = $wpseo_front->metadesc( false );
        echo '<meta itemprop="description" content="' . esc_attr( strip_tags( stripslashes( $metadesc ) ) ) . '" />' . "\n";
    }
}
add_action( 'wp_head', 'yourtheme_meta_schema' );
?>

Wondering if this kind of functionality could be baked in?

@Yoast I should have clarified a little further, there are other things you can do to add schema markup to the head in addition to the title tag which WordPress SEO could add. For example the canonical link and meta description tags.

There is an interesting article by Felix Arntz with a function that modifies these tags using the WPSEO_Frontend class:

<?php 
function yourtheme_meta_schema()
{
    if( class_exists( 'WPSEO_Frontend' ) )
    {
        global $wpseo_front;

        $canonical = $wpseo_front->canonical( false );
        echo '<link itemprop="url" href="' . esc_url( $canonical, null, 'other' ) . '" />' . "\n";
        $metadesc = $wpseo_front->metadesc( false );
        echo '<meta itemprop="description" content="' . esc_attr( strip_tags( stripslashes( $metadesc ) ) ) . '" />' . "\n";
    }
}
add_action( 'wp_head', 'yourtheme_meta_schema' );
?>

Wondering if this kind of functionality could be baked in?

@iagdotme

This comment has been minimized.

Show comment
Hide comment
@iagdotme

iagdotme Aug 20, 2013

And of course it would be good if breadcrumbs used microdata - https://support.google.com/webmasters/answer/185417?hl=en

And of course it would be good if breadcrumbs used microdata - https://support.google.com/webmasters/answer/185417?hl=en

@jdevalk

This comment has been minimized.

Show comment
Hide comment
@jdevalk

jdevalk Aug 20, 2013

Member

Breadcrumbs already use RDFA, as that's Google's preferred method. As for canonical and meta description: the plugin already does those, but doesn't use the itemprop attribute...

Member

jdevalk commented Aug 20, 2013

Breadcrumbs already use RDFA, as that's Google's preferred method. As for canonical and meta description: the plugin already does those, but doesn't use the itemprop attribute...

@iagdotme

This comment has been minimized.

Show comment
Hide comment
@iagdotme

iagdotme Aug 20, 2013

@Yoast I had assumed Google preferred schema for everything. Strange they prefer RDFa for breadcrumbs and microdata for everything else. I'd be interested in where they state this.
Would it be possible for the plugin to add the itemprop attribute to the canonical and meta description?

@Yoast I had assumed Google preferred schema for everything. Strange they prefer RDFa for breadcrumbs and microdata for everything else. I'd be interested in where they state this.
Would it be possible for the plugin to add the itemprop attribute to the canonical and meta description?

@felixarntz

This comment has been minimized.

Show comment
Hide comment
@felixarntz

felixarntz Aug 21, 2013

Member

Hello everyone, in my opinion Schema.org goes pretty much into WordPress themes, so I don't think it would be really coherent using only a plugin.

@Yoast I would prefer a way to access all the meta information from your SEO plugin from outside. Your class methods 'canonical' and 'metadesc' allow to only return the content instead of echoing it - so why not do this for all meta information? This way one could easily add the necessary Schema.org attributes in there when outputting the content manually.

Member

felixarntz commented Aug 21, 2013

Hello everyone, in my opinion Schema.org goes pretty much into WordPress themes, so I don't think it would be really coherent using only a plugin.

@Yoast I would prefer a way to access all the meta information from your SEO plugin from outside. Your class methods 'canonical' and 'metadesc' allow to only return the content instead of echoing it - so why not do this for all meta information? This way one could easily add the necessary Schema.org attributes in there when outputting the content manually.

@felixarntz

This comment has been minimized.

Show comment
Hide comment
@felixarntz

felixarntz Aug 21, 2013

Member

@Yoast I just wrote a class that modifies the breadcrumbs from your plugin to use Schema.org markup instead of RDFa. I just did it exactly the way 'data-vocabulary.org' tells you to use it, but instead used 'schema.org' links - this seems to work fine for Google, at least it did in a few tests. I embedded the class in this short article - http://leaves-and-love.net/how-to-modify-wp-seo-breadcrumbs-for-schema-org/

This might be useful for someone who wants his theme to use Schema.org, but take meta information, breadcrumbs and such from the WordPress SEO plugin.

Member

felixarntz commented Aug 21, 2013

@Yoast I just wrote a class that modifies the breadcrumbs from your plugin to use Schema.org markup instead of RDFa. I just did it exactly the way 'data-vocabulary.org' tells you to use it, but instead used 'schema.org' links - this seems to work fine for Google, at least it did in a few tests. I embedded the class in this short article - http://leaves-and-love.net/how-to-modify-wp-seo-breadcrumbs-for-schema-org/

This might be useful for someone who wants his theme to use Schema.org, but take meta information, breadcrumbs and such from the WordPress SEO plugin.

@jdevalk

This comment has been minimized.

Show comment
Hide comment
@jdevalk

jdevalk Aug 21, 2013

Member

Google itself still states it prefers RDFa for breadcrumbs, simply because the schema markup for it isn't exactly specific and rather hard to parse for them, see this:

http://lists.w3.org/Archives/Public/public-rdfa-wg/2012Nov/0027.html

Member

jdevalk commented Aug 21, 2013

Google itself still states it prefers RDFa for breadcrumbs, simply because the schema markup for it isn't exactly specific and rather hard to parse for them, see this:

http://lists.w3.org/Archives/Public/public-rdfa-wg/2012Nov/0027.html

@felixarntz

This comment has been minimized.

Show comment
Hide comment
@felixarntz

felixarntz Sep 13, 2013

Member

But what exactly in this email tells you that RDFa is preferred over Schema.org? I don't understand everything in the mail, so it would be nice if you could illuminate me on that a bit.

Google generally recommends using Schema.org, and it works for breadcrumbs aswell. Maybe this is just my personal opinion, but I think it would be more coherent to use Schema.org for everything. Of course that would be different if there were errors or if it could not be recognized by Google, but that isn't the case.

Member

felixarntz commented Sep 13, 2013

But what exactly in this email tells you that RDFa is preferred over Schema.org? I don't understand everything in the mail, so it would be nice if you could illuminate me on that a bit.

Google generally recommends using Schema.org, and it works for breadcrumbs aswell. Maybe this is just my personal opinion, but I think it would be more coherent to use Schema.org for everything. Of course that would be different if there were errors or if it could not be recognized by Google, but that isn't the case.

@Mte90

This comment has been minimized.

Show comment
Hide comment
@Mte90

Mte90 Nov 11, 2013

Any news for this feature?

Mte90 commented Nov 11, 2013

Any news for this feature?

@Willem-Siebe

This comment has been minimized.

Show comment
Hide comment
@Willem-Siebe

Willem-Siebe Feb 27, 2014

Hi, last time we checked this on the rich snippet tester from Google, is that breadcrumbs based on schema.org are not working! That Yoast is using rDFA is the right choise, because that is working.

Hi, last time we checked this on the rich snippet tester from Google, is that breadcrumbs based on schema.org are not working! That Yoast is using rDFA is the right choise, because that is working.

@jdevalk

This comment has been minimized.

Show comment
Hide comment
@jdevalk

jdevalk Mar 5, 2014

Member

So, as long as Google themselves recommend using rDFA over Schema, and they have repeatedly done so in the above thread and elsewhere as well as in private email, we're sticking with that. Closing this issue for now.

Member

jdevalk commented Mar 5, 2014

So, as long as Google themselves recommend using rDFA over Schema, and they have repeatedly done so in the above thread and elsewhere as well as in private email, we're sticking with that. Closing this issue for now.

@jdevalk jdevalk closed this Mar 5, 2014

@monecchi

This comment has been minimized.

Show comment
Hide comment
@monecchi

monecchi Feb 6, 2017

I've got a variable product with 4 different prices. I've managed to markup each product in a way google gives me a nice price range snippet from the lowest to the highest...

e.g

img_0056

It turns out if I use WordPress SEO breadcrumb rDFA markup, that nice price range snippet is gone.

I've performed a few tests, and it seems that If I remove the rDFA breadcrumbs the snippet comes back.

There's no such issue though marking up a custom breadcrumb with https://schema.org/BreadcrumbList

Weird I know, but I had to drop rdfa in favor of the schema markup in order to get the snippets to show the way I wanted them to be.

monecchi commented Feb 6, 2017

I've got a variable product with 4 different prices. I've managed to markup each product in a way google gives me a nice price range snippet from the lowest to the highest...

e.g

img_0056

It turns out if I use WordPress SEO breadcrumb rDFA markup, that nice price range snippet is gone.

I've performed a few tests, and it seems that If I remove the rDFA breadcrumbs the snippet comes back.

There's no such issue though marking up a custom breadcrumb with https://schema.org/BreadcrumbList

Weird I know, but I had to drop rdfa in favor of the schema markup in order to get the snippets to show the way I wanted them to be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment