Co-Authors-Plus icon indicating copy to clipboard operation
Co-Authors-Plus copied to clipboard

Adds the Yoast integration

Open leogermani opened this issue 2 years ago • 0 comments

This PR adds the Yoast integration.

This integration was initially developed as part of Yoast itself -> https://github.com/Yoast/wordpress-seo/pull/18331

I then added support to Guest Authors and did a couple of other improvements in -> https://github.com/Yoast/wordpress-seo/pull/19076

However, while chatting with @jdevalk, we agreed that it would be better if this integration lived in the CoAuthors plugin.

So this PR moves the whole integration, with my additions to the CoAuthors codebase.

Note: This only acts on Yoast filters so it should have no effect on sites not running Yoast.

Test instructions

This PR can be acceptance tested by following these steps:

  • Enable Yoast and CoAuthors Plus plugin
  • Create a post

Now try different authorship states and check the resulting schema:

  • Visit the post you created and look at the source code
  • We want to look at the schema that is inserted in the <script type="application/ld+json" class="yoast-schema-graph"> tag
  • Make sure the "author" key has a list of IDs and they match the authors you have set up for the post:
"@graph": [
	        {
	            "@type": "Article",
	            "@id": "https://leogermani.jurassic.tube/2022/09/15/venenatis-dapibus-odio-sollicitudin-ultricies-magna-sem-hac-hendrerit-cursus-faucibus/#article",
	            "isPartOf": {
	                "@id": "https://leogermani.jurassic.tube/2022/09/15/venenatis-dapibus-odio-sollicitudin-ultricies-magna-sem-hac-hendrerit-cursus-faucibus/"
	            },
	            "author": [
	                {
	                    "@id": "https://leogermani.jurassic.tube/#/schema/person/743c49680386c3bcf517e1753cd46a25"
	                }
	            ],
 ...
  • The example above shows a post with only one author
  • At the end of the schema, look for the Person sections. There should be one section for each author you added to the post. Example:
	        {
	            "@type": "Person",
	            "@id": "https://leogermani.jurassic.tube/#/schema/person/743c49680386c3bcf517e1753cd46a25",
	            "name": "leo",
	            "image": {
	                "@type": "ImageObject",
	                "inLanguage": "en-US",
	                "@id": "https://leogermani.jurassic.tube/#/schema/person/image/00d99ee8603d99603d8c6be4dbc57016",
	                "url": "https://secure.gravatar.com/avatar/ea8b076b398ee48b71cfaecf898c582b?s=96&d=mm&r=g",
	                "contentUrl": "https://secure.gravatar.com/avatar/ea8b076b398ee48b71cfaecf898c582b?s=96&d=mm&r=g",
	                "caption": "leo"
	            },
	            "sameAs": [
	                "http://localhost"
	            ],
	            "mainEntityOfPage": {
	                "@id": "https://leogermani.jurassic.tube/author/leo/"
	            }
	        }
  • The persons in the list must match the IDs in the author key we saw above.
  • Confirm that the <meta name="author" .. tag correctly displays the name of all authors
  • Repeat the above steps changing the post authorship with different combinations:
    • only one regular author
    • 2 or more authors who are regular users
    • mix of regular users and guest authors as authors of the post
    • only one guest author as the post author
    • multiple guest authors as post authors
    • Also test guest authors with and without avatars, and with and without emails with gravatars. Check that the image tag is properly added in all cases.
  • Visit an author archive page for both a regular author and a guest author and make sure the schema for profilePage has the right links

leogermani avatar Oct 25 '22 20:10 leogermani