Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with Yoast's new Schema API #710

Open
WPprodigy opened this issue Oct 25, 2019 · 11 comments
Open

Integrate with Yoast's new Schema API #710

WPprodigy opened this issue Oct 25, 2019 · 11 comments

Comments

@WPprodigy
Copy link
Contributor

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.

@lubieowoce
Copy link

lubieowoce commented Oct 26, 2019

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>

  • Articles "written by" guest authors have their author 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 correct Person

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 :/


  1. ...because they use get_queried_object_id which returns the guest-author post, and they're expecting a user id

@lubieowoce
Copy link

lubieowoce commented Oct 27, 2019

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!


  1. 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

@mekanics
Copy link

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?

@lubieowoce
Copy link

lubieowoce commented Aug 30, 2020

@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

@mekanics
Copy link

@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 😉

@claudiulodro
Copy link
Contributor

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!

@anteksiler
Copy link

Any update on this one?

@rebeccahum
Copy link
Contributor

@anteksiler Feel free to open a PR!

@leogermani
Copy link
Contributor

leogermani commented Oct 5, 2022

Hello everyone, I've got some news:

Recently Yoast added an integration with CoAuthors Plus in its core:

Yoast/wordpress-seo#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:

leogermani/wordpress-seo#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

@leogermani
Copy link
Contributor

I think I've managed to address all the issues we found. There's a PR to the Yoast repo now:

Yoast/wordpress-seo#19076

@bjorn2404
Copy link

Hello,

Following the comments here and in Yoast/wordpress-seo#19076 and #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants