Co-Authors-Plus
Co-Authors-Plus copied to clipboard
Integrate with Yoast's new Schema API
Info: https://yoast.com/yoast-seo-11-0/
Extending docs: https://developer.yoast.com/features/schema/api/#add-or-remove-graph-pieces
CAP should ensure it uses the co-author data and not the core WP author data.
i've just encountered this problem. i started working around it, i'll post my hacks when i get something useful working.
things that (i noticed) work incorrectly on my site:
schema.org metadata in <head>
-
Article
s "written by" guest authors have theirauthor
attribute set to the user who created the post instead. (check yours with google's tool) -
guest author archive
ProfilePages
aren't linked to the correctPerson
misc
- titles of author archives for guest authors. right now Yoast tries to look up the user with the id of the
guest-author
post¹ and understandably get either null or garbage data. in some places, they seem to use the data of the actual user who created the guest-author e.g. the%%name%%
snippet variable used for the page's title.
i'm afraid the fix will be pretty ugly and/or it will duplicate a bunch of Yoast's logic. they seem to assume the author is a user in multiple disconnected places :/
- ...because they use
get_queried_object_id
which returns theguest-author
post, and they're expecting a user id
Here's the integration code i hacked together:
https://gist.github.com/lubieowoce/46d917b10a85d4195185dff347db9206
i'm still improving it (and updating the gist as i go), but it fixes the problems i had. it's probably not very robust and makes some site-specific assumptions¹, so please read the code before using it – i did my best to document them (comments starting with NOTE: ...
). any ideas for improving it are welcome!
- e.g. we only publish works submitted by external authors, so the user who created the post doesn't matter; the real author is added via guest-authors. none of the guest-authors are assigned to real users
I think we're having the same issue.
Google Search Console has detected a covarage issue. Every Co-Author page have the meta tag robots
set to noindex, follow
instead of index, follow
. (This is set by Yoast)
After investigating I found out that the schema and the og:url
have some wrong data as well (also set by Yoast).
And now here I am...
@lubieowoce do you have your fix still in production? Where did you add the fix?
@mekanics my fix required some modifications after updating to Yoast 14 bc they changed a whole bunch of stuff, but yeah, it's still running :) i'll post the new version here soon.
Where did you add the fix?
the code just does a bunch of add_action/add_filter
, so you can add it wherever, even copypaste it into your functions.php or put it in a file and include
it
PS. does your site have a user for each guest_author? mine doesn't, and I wrote the fix with that in mind, so it could require some tweaking
@lubieowoce thank you very much! So I guess, we will have to try your solution as soon has we find time.
does your site have a user for each guest_author?
No, they don't have one either – lucky us 😉
Looks like Yoast is adding a filter for modifying the schema author data in v16.3, which should make this change much simpler. This feature marches closer to completion!
Any update on this one?
@anteksiler Feel free to open a PR!
Hello everyone, I've got some news:
Recently Yoast added an integration with CoAuthors Plus in its core:
https://github.com/Yoast/wordpress-seo/pull/18161
From what I could see, it now supports multiple authors for a post, but it does not support guest authors yet.
I've started working on this and the help from everyone here with testing, validating and (even better) some code would be awesome. Once we have this ready we can open a PR to the official Yoast repository:
https://github.com/leogermani/wordpress-seo/pull/1
I'm new to both CoAuthors Plus and Yoast, so getting an eye from some of you who know this issue in more depth would be great.
cc @lubieowoce
I think I've managed to address all the issues we found. There's a PR to the Yoast repo now:
https://github.com/Yoast/wordpress-seo/pull/19076
Hello,
Following the comments here and in https://github.com/Yoast/wordpress-seo/pull/19076 and https://github.com/Automattic/Co-Authors-Plus/pull/877 but noticing that neither the Person or ProfilePage schema is appearing on single Guest Author pages when testing. In the Yoast settings I have the Guest Authors post type Schema set to Profile
.