• Resolved arafail

    (@arafail)


    Hello!
    We have encountered a new issue with your plugin, after the last update.
    The plugin has added the schema code below, and google has reported that it is not valid.
    We have indeed tested it and it is invalid. – https://search.google.com/structured-data/testing-tool#url=https%3A%2F%2Fwww.digitalcitizen.life%2Flatest%2F
    How can we remove this code?
    Thank you!

    <script type="application/ld+json">{"@context":"http:\/\/schema.org","publisher":{"@type":"Organization","name":"Digital Citizen","logo":{"@type":"ImageObject","url":"https:\/\/www.digitalcitizen.life\/wp-content\/plugins\/amp\/assets\/images\/amp-page-fallback-wordpress-publisher-logo.png"}},"@type":"BlogPosting","mainEntityOfPage":"https:\/\/www.digitalcitizen.life\/5g\/","headline":"What are 5G and its benefits? What 5G smartphones are available?","datePublished":"2020-10-10T19:01:47+03:00","dateModified":"2020-11-30T10:36:27+02:00","author":{"@type":"Person","name":"Ciprian Adrian Rusen"}}</script>

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Milind More

    (@milindmore22)

    Hello @arafail,

    The AMP plugin provides basic structured data that is needed to create a Valid AMP page and not meant to fully support it, I will recommend using plugins that are specifically created to serve that purpose like Yoast SEO.

    After checking your page, it seems to be missing a featured image. you can use amp_schemaorg_metadata filter to adjust schema data and add a default placeholder image. (an image that represent your site)

    add_filter(
    	'amp_schemaorg_metadata',
    	function ( $metadata ) {
    		$queried_object = get_queried_object();
    		if ( $queried_object instanceof WP_Post ) {
    
    			// Featured image Place holder. if you don't have featured image.
    			$url = 'https://yoursite.com/wp-content/uploads/2020/07/placeholder.jpg';
    
    			if ( has_post_thumbnail( $queried_object ) ) {
    				$url = get_the_post_thumbnail_url( $queried_object );
    			}
    				$metadata['image'] = [
    					'@type' => 'ImageObject',
    					'url'   => $url,
    				];
    		}
    		return $metadata;
    	}
    );
    

    If you have other plugin or your theme inserts schema data you can disable AMP schema by returning an empty array

    
    add_filter( 'amp_schemaorg_metadata', '__return_empty_array' );
    

    Let me know if that helps!

    Plugin Author Weston Ruter

    (@westonruter)

    Also, if you have a plugin that adds Schema.org metadata, then the AMP plugin won’t add its own. So for example, Yoast SEO adds Schema.org metadata to the page. When this happens, the AMP plugin bypasses adding its own. So you don’t have to manually prevent AMP from adding its metadata.

    As Milind noted, the AMP plugin adds basic Schema.org metadata, so it you want more advanced metadata then it is best to use a plugin dedicated for that purpose, like Yoast SEO.

    Thread Starter arafail

    (@arafail)

    Hello!
    Thank you for the code it works perfectly.

    Our schema is custom added, without any plugins, however here are a few observations:

    1: You plugin added a “blogposting” schema to a blog listing page – the page in question is a list of the most recent articles published on that blog.
    2: The plugin took the title of the first post in that listing and used it to populate it’s schema, which is not really ok.
    3: Since there is no featured image on the category the plugin added an image from the plugin’s folder, but the schema.org tester did not validate that image.

    Thanks again!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘New schema code by AMP’ is closed to new replies.