Community Forums › Forums › Archived Forums › General Discussion › Problem with Schema with Genesis 2.2
Tagged: Genesis 2.2, schema
- This topic has 38 replies, 10 voices, and was last updated 8 years, 4 months ago by jamesjd7.
-
AuthorPosts
-
September 3, 2015 at 5:57 am #164409cruisegleMember
After updating to Genesis 2.2 I went to the Google structured data testing tool and discovered a fault with the markup with the search box.
The problem is in this part of the code within the markup.php file.
add_filter( 'genesis_attr_search-form', 'genesis_attributes_search_form' );
/**
* Add attributes for search form.
*
* @since 2.2.0
*
* @param array $attributes Existing attributes.
*
* @return array Amended attributes.
*/
function genesis_attributes_search_form( $attributes ) {$attributes['itemprop'] = 'potentialAction';
$attributes['itemscope'] = 'itemscope';
$attributes['itemtype'] = 'http://schema.org/SearchAction';
$attributes['method'] = 'get';
$attributes['action'] = home_url( '/' );
$attributes['role'] = 'search';return $attributes;
}
If the word itemscope is removed from the $attributes['itemscope'] it seems to pass the structured testing tool.
A quick fix that worked for me was to add this to the functions file within the back-end of WordPress; (appearance(editor)).
add_filter( 'genesis_attr_search-form', 'remove_searchform_body_schema' );
function remove_searchform_body_schema( $attributes ){$attributes['itemscope'] = '';
return $attributes;
}I am not a coder by any means so could someone please check this to see if a correct temporary solution?
I’m an SEO Consultant by trade; who is getting by; just!
September 3, 2015 at 6:57 am #164415Victor FontModeratorThere are some microdata tutorials on the net that teach that itemscope should be itemscope="itemscope". However, from the examples on schema.org, itemscope is always used as a stand alone keyword. It has no modifiers or parameters. I think you are right in the way you modified the code and the example you took it from is wrong.
The Genesis 2.2 release seems to have a few issues. I turned on accessibility for 2 production sites so far and they both broke. Going 0 for 2 out of the box is not a good score.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?September 3, 2015 at 8:10 am #164424Victor FontModeratorHere is the spec for itemscope. It is a boolean value. It does not take an argument: http://www.w3.org/TR/microdata/#attr-itemscope. Assigning a value of "itemscope" to it is incorrect markup. The Google structured data test is right.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?September 3, 2015 at 8:15 am #164425David ChuParticipantThanks, Victor!
As a coder, I had been puzzled by itemscope='itemscope', which seems to be all over the place, possibly due to those tuts you mentioned.I couldn't decide if this would simply be from the Department of Redundancy Department, or could even result in a singularity, sucking all matter into a black hole.
Dave
Dave Chu ยท Custom WordPress Developer – likes collaborating with Designers
September 3, 2015 at 8:42 am #164432Victor FontModeratorLOL!!!
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?September 3, 2015 at 12:29 pm #164489emmtreParticipantAre StudioPress going to fix this? There are itemscope="itemscope" all over.
And why are there schema.org microdata markup in the <head> tag?
Shouldn't the schema.org microdata markup be placed in the <html> tag?
When using Yoast SEO and WPSSO plugins there are now conflicts.
September 3, 2015 at 12:51 pm #164492emmtreParticipantAnd why is itemtype="http://schema.org/WebSite" placed in the <head> tag on all pages?
Shouldn't the homepage be "Blog" and other pages/posts be "Article", "Products", etc.
September 3, 2015 at 1:11 pm #164493Nathan RiceMemberLet me clear some things up for everybody ...
1. Using
itemscope="itemscope"
is perfectly fine, as far as I know. My site, http://nathanrice.net/, throws no errors with this. The only errors are in regards to missing images for blogPosting (not invalid, but an image is required if you want a rich snippet in search results pages).Feel free to test yourself:
https://developers.google.com/structured-data/testing-tool/2. Schema.org microdata in the
<head>
usually has to do with information about the site. In the case of the new markup we added in 2.2, this has to do with the http://schema.org/WebSite property. You can read more from Google here: http://googlewebmastercentral.blogspot.com/2015/04/better-presentation-of-urls-in-search.htmlThis code, by the way, is only added on the homepage. For obvious reasons.
3. Page types (Blog, BlogPosting, Article, etc.) are still there. Look on the
<body>
and<article>
tags. These are not mutually exclusive to the WebSite property.September 3, 2015 at 1:55 pm #164504emmtreParticipantThanx for your comments Nathan!
1. Could be but according to W3C "the itemscope attribute is a boolean attribute" and some people get errors.
http://www.w3.org/TR/microdata/#attr-itemscope
2. The problem is that http://schema.org/WebSite is added to all pages in the <head> and not only the homepage.
If you put the markup in the <html> tag there are standard hooks that can be used by plugin developers.
And since other plugins like Yoast SEO and WPSSO puts the microdata in the <html> there are now conflicts.
September 3, 2015 at 2:03 pm #164506emmtreParticipantAnd can we expect full http://schema.org/BreadcrumbList microdata markup?
September 3, 2015 at 2:05 pm #164507Nathan RiceMember1. That's a valid point. I don't think it'll hurt anything for the time being, but that's definitely something we can solve.
2. Hm, that wasn't intentional. Thanks for pointing that out.
We have a markup API that we use to add those attributes to HTML elements, so the mechanism to remove it (or rather, conditionally add it in this case) is already there. I must have just forgotten to put in the conditional.
And since other plugins like Yoast SEO and WPSSO puts the microdata in the there are now conflicts.
You're 3 for 3 on this one ๐ Looks like we need to add you to the Genesis Github repo to QA for us on the next development cycle!
Again, it was my intention to remove this if an SEO plugin was active, but it look like I forgot. I'm creating an issue in GH now so this can all be fixed in 2.2.1.
September 3, 2015 at 2:10 pm #164509Nathan RiceMemberAnd can we expect full http://schema.org/BreadcrumbList microdata markup?
This is what I get when I test against my site. Is there something missing?
September 3, 2015 at 2:49 pm #164510emmtreParticipantMany thanx again Nathan for your quick reply! I'm looking forward to the fixes in 2.2.1.
Regarding breadcrumbs Google recommends more extensive markup for mobile search.
https://developers.google.com/structured-data/breadcrumbs
Here is an example.
<ol itemscope itemtype="http://schema.org/BreadcrumbList"> <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"> <a itemprop="item" href="https://example.com/arts"> <span itemprop="name">Arts</span></a> <meta itemprop="position" content="1" /> </li> โบ <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"> <a itemprop="item" href="https://example.com/arts/books"> <span itemprop="name">Books</span></a> <meta itemprop="position" content="2" /> </li> โบ <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"> <a itemprop="item" href="https://example.com/arts/books/poetry"> <span itemprop="name">Poetry</span></a> <meta itemprop="position" content="3" /> </li> </ol>
September 3, 2015 at 2:57 pm #164511emmtreParticipantWhen using the Genesis Blog template for blog pages I get the following error message.
Google doesn't recognize the property mainContentOfPage for an object of type Blog.
<main class="content" role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/Blog">
Is this a known problem or something that also can be fixed?
September 3, 2015 at 5:12 pm #164520jsmorissMemberHi everyone,
I'm the author of NGFB and WPSSO, two plugins that add schema markup (among many other social meta tags) to the head section of webpages. By default, WordPress offers a hook into the <html> tag, but not the <head> tag, so typically SEO-type plugins add itemscope/itemtype markup for the webpage into the <html> tag. Genesis 2.2 has it's own non-standard filters and adds schema markup to the <html> tag where standard WordPress plugins/themes can't get at it. For example, from the 2015 theme:
<html <?php language_attributes(); ?> class="no-js">
<head>And what it may look like after being filtered:
<html lang="en-US" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#" itemscope itemtype="http://schema.org/Article">
<head>I would gladly hook into the <head> tag to manage the schema type if a filter existed. It seems Genesis 2.2 offers that possibility. Can anyone point me to some documentation that describes its <head> filter?
Thanks,
js.
September 3, 2015 at 10:56 pm #164525Nathan RiceMember@emmtre
I've gone through and committed fixes for all the stuff you brought up. If you would like access to the Github repo, I would love to have you in there to take a look at the fixes to verify they're working right for you.As for the breadcrumb schema, it looks like the only difference is that we mistakenly put
itemprop="url"
on the anchor, and it should beitemprop="item"
instead. I've fixed this in github.With regard to the blog page template and
mainContentOfPage
, we have a conditional in the code that is supposed to explicitly prevent this. And on my local install, this doesn't seem to be happening for me. Can you give me more details about what steps I can take to recreate this on my site?September 3, 2015 at 11:02 pm #164527Nathan RiceMemberFirst of all, let me know if your plugins are full featured SEO plugins. I can add them to the list of plugins we detect and use to turn off our SEO features.
But if not, and they can be active alongside Genesis SEO, it sounds like there's a bit of a conflict between our WebSite schema. To fix this, you can either disable our output altogether by unhooking our code (no performance issues, no real risk), detect Genesis is active and disable your output for this bit of schema, or I guess you could do a combination of both and use our markup API to output the right schema to the
<head>
element.It's up to you, but if it were me, I'd go with option 1, mainly because it's the least amount of work for you ๐
Here's the code to disable it.
remove_action( 'wp_head', 'genesis_meta_name' ); remove_action( 'wp_head', 'genesis_meta_url' ); remove_filter( 'genesis_attr_head', 'genesis_attributes_head' ); add_filter( 'genesis_attr_head', 'genesis_attributes_empty_class' );
September 3, 2015 at 11:34 pm #164531macrunnerParticipantHello Nathan, first thanks for all the work
I have read that it will be released version 2.2.1
it is possible to estimate, even approximate, on the release date of this new version?Thank you very much
September 4, 2015 at 9:28 am #164576emmtreParticipantThanx Nathan! Keep up the good work!
Please add me to the GitHub repro and I can test on one site where we have a problem and conflicts now. I have the same username on GitHub as here. Or you can get my email via the ticket I filed yesterday with reference to this thread.
I tried to look at the conditionals in the code but I can't figure out what's going on. I get various markup for different sites. I thought it was because of using custom Genesis loops or custom fields and query_args with the Blog template.
(I know Bill Erickson says "Don’t use the Genesis blog template" but I sometimes do instead of using category pages...)
But that's probably not the reason since I have other sites with more or less the same set-up. But the Genesis child themes are different. If you want I can file a ticket so you can have a closer look at one site with these markup errors.
<div class="content-sidebar-wrap"> <main class="content" role="main" itemprop="mainContentOfPage" itemscope="itemscope" itemtype="http://schema.org/Blog">
Is it still ok and safe to use the Microdata Manager plugin by Brad Potter with the new Gensis version even if it hasn't been updated for over two years? The plugin is easy to use to set microdata markup like AboutPage or ContactPage.
September 4, 2015 at 9:39 am #164579Nathan RiceMember@emmtre
You should have access now. Let me know if you don't receive the invite. [email protected]If you can avoid using the Blog template, that would be my recommendation. I'll be honest, making the conditionals work 100% of the time in all the various scenarios (for instance, create page > assign blog template > make blog page the homepage ... weird setups like that) is incredibly difficult.
It should probably still be safe to use the microdata manager plugin, but it's totally possible that the plugin may cause problems. A quick look at the code gives me pause ... it basically takes over and overrides all the default Genesis microdata for main, entry, entry-title, and entry-content with no conditionals. Could definitely be a problem.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.