ArticleBody schema

#578706
  • ED
    free

    How can i add ArticleBody schema in Rankmath? i want to add whole content in Articlebody schema, if it’s not possible then want to add description text in articlebody

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    You can use this filter to add the articleBody schema on your site:

    /**
     * Filter to change the schema data.
     * Replace $schema_type with schema name like article, review, etc.
     * @param array $entity Snippet Data
     * @return array
     */
    add_filter( "rank_math/snippet/rich_snippet_article_entity", function( $entity ) {
     	$entity['articleBody'] = wp_strip_all_tags(get_the_content());
    	return $entity;
    });

    And here’s how you can add the filter:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope that helps.

    Thank you.

    Thanks. Can i apply same way for AMP pages? Specially in “AMP for WP – Accelerated Mobile Pages” plugin?

    Hello,

    Yes, that filter will be applied to them since it targets all of your pages where the article schema is being used.

    You can verify that as well using these tools:
    https://search.google.com/test/rich-results
    https://validator.schema.org/

    Looking forward to helping you.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this ticket.