• Resolved webarchitect88

    (@webarchitect88)


    Below is an example schema for my offer page.
    I need a part of schema with an offer, but no more.
    However, the plugin outputs the following data to me in sequence: #organization, #website, #web page – i dont need them on this page.
    Moreover – I dont need a schema on the post category pages at all.
    How can I disable the unnecessary and display only the necessary?

    {
        "@context": "https://schema.org",
        "@graph": [
            {
                "@type": [
                    "Website",
                    "Organization"
                ],
                "@id": "https://mysite.ru/#organization",
                "name": "My Company",
                "url": "https://mysite.ru",
                "email": "[email protected]",
                "address": {
                    "@type": "PostalAddress",
                    "addressRegion": "Krasnodarskiy Kray",
                    "addressCountry": "Russia"
                },
                "logo": {
                    "@type": "ImageObject",
                    "url": "https://mysite.ru/wp-content/uploads/2020/12/logotypesq.png"
                },
                "contactPoint": [
                    {
                        "@type": "ContactPoint",
                        "telephone": "+7-000-000-0000",
                        "contactType": "customer support"
                    }
                ],
                "openingHours": [
                    "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday 12:00-23:00"
                ],
                "priceRange": "$$$$"
            },
            {
                "@type": "WebSite",
                "@id": "https://mysite.ru/#website",
                "url": "https://mysite.ru",
                "name": "My Company",
                "publisher": {
                    "@id": "https://mysite.ru/#organization"
                },
                "inLanguage": "ru-RU",
                "potentialAction": {
                    "@type": "SearchAction",
                    "target": "https://mysite.ru/?s={search_term_string}",
                    "query-input": "required name=search_term_string"
                }
            },
            {
                "@type": "ImageObject",
                "@id": "https://mysite.ru/landing-page/#primaryImage",
                "url": "https://mysite.ru/wp-content/uploads/2020/12/logotype.png",
                "width": 1510,
                "height": 850
            },
            {
                "@type": "WebPage",
                "@id": "https://mysite.ru/landing-page/#webpage",
                "url": "https://mysite.ru/landing-page/",
                "name": "Creating of Landing Page",
                "datePublished": "2020-08-14T04:14:23+03:00",
                "dateModified": "2020-12-30T15:21:29+03:00",
                "isPartOf": {
                    "@id": "https://mysite.ru/#website"
                },
                "primaryImageOfPage": {
                    "@id": "https://mysite.ru/landing-page/#primaryImage"
                },
                "inLanguage": "ru-RU"
            },
            {
                "@type": "Service",
                "name": "Creating of Landing Page",
                "description": "Short description",
                "serviceType": "website development",
                "offers": {
                    "@type": "Offer",
                    "name": "laning page",
                    "price": "500",
                    "priceCurrency": "USD",
                    "availability": "InStock"
                },
                "@id": "https://mysite.ru/landing-page/#schema-4581",
                "image": {
                    "@id": "https://mysite.ru/landing-page/#primaryImage"
                },
                "mainEntityOfPage": {
                    "@id": "https://mysite.ru/landing-page/#webpage"
                }
            }
        ]
    }
Viewing 1 replies (of 1 total)
  • Plugin Author Rank Math SEO

    (@rankmath)

    Hello @webarchitect88,

    Thank you for contacting the support and sorry for not following up quickly and any inconvenience that might have been caused due to that.

    You can use the following filter, by adding it to your theme’s functions.php file, to remove the Schema data completely on the category pages:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	if ( is_category() ) {
    		return [];
    	}
    	return $data;
    }, 999, 2 );

    And the other entities which you want to remove from the Single page Schema are the required entities. Without them, the Schema will not work properly.

    Still, if you want to remove those entities then you can use the following filter code:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	foreach ( [ 'publisher', 'WebSite', 'WebPage' ] as $entity ) {
    		unset( $data[ $entity ] );
    	}
    	foreach ( $data as $key => $schema ) {
    		foreach ( [ 'isPartOf', 'publisher', 'mainEntityOfPage' ] as $property ) {
    			if ( isset( $schema[ $property ] ) ) {
    				unset( $data[ $key ][ $property ] );
    			}
    		}
    	}
    	return $data;
    }, 999, 2);

    Hope that helps.

Viewing 1 replies (of 1 total)
  • The topic ‘excess data in the schema org block’ is closed to new replies.