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

The Yoast schema output is inconsistent in terms of unicode encoding special characters or not #18274

Open
2 tasks done
Telsenome opened this issue Mar 28, 2022 · 3 comments
Open
2 tasks done

Comments

@Telsenome
Copy link

Telsenome commented Mar 28, 2022

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

JSON-LD output

In most places in the structured data schema special characters are unicode encoded in the json-ld output.

https://imgur.com/a/Vag0UDu
https://imgur.com/a/Dst6f9f

But I've noticed this is not always the case, in the output schema there are places where special characters are not unicode encoded. For example yoast_head_json.og_title and yoast_head_json.WebPage.name, so the & is output like below:

"og_title": "Question & answers"

{
"@type": "WebPage",
name": "Question & answers"
}

But at the same time BreadcrumbList.ListItem.name and Question.name are unicode encoded. So the output is inconsistent.

Meta data

The same goes for meta data. The og:data, <title> and meta desc do not encode text the same. For example, yoast_head_json.og_description is not unicode encoded. But the og:description in "yoast_head" is.

How can we reproduce this behavior?

  1. Add a special character to the title of a blogpost
  2. Check the wp-json response of that blogpost, namely the "yoast_head_json" part of the response
@Telsenome Telsenome changed the title The json-ld output is not consistent in terms of whether special characters should be unicode encoded or not The Yoast schema output is inconsistent in terms of unicode encoding special characters or not Apr 6, 2022
@Telsenome
Copy link
Author

@Djennez Not sure if inconsistency in the schema output actually matters, but thought I should let you know. What would you say, should all entries in the json-ld be encoded the same or doesn't it matter?

@Djennez
Copy link
Member

Djennez commented Apr 6, 2022

I don't think it matters. Since schema is meant for computerized consumption it'll get properly decoded on the parsing end anyway, before any human reads it. It might be a bit annoying for debugging purposes I suppose.

@Telsenome
Copy link
Author

@Djennez Yeah, I think you're right

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

2 participants