简体   繁体   中英

what characters are allowed in google search structured data

I want to use google rich search results with structured data.

I'm confused about what characters the description tag can take.

For example, I want to use

{ description: "this is a backslash \\ here" }

I know JSON does not allow a backslash without escaping

My question is if I replace the \\ with \\' like this

{ description: "this is a backslash \\ here" }

Will this display \\ on the rendered page or will it display '\\'

Google will parse the data using the json rules so will most likely see it as a backslash.

A way to get an idea is to run a comment like this in your browsers console.

console.log({ description: "this is a backslash \u005C here" });

This also results in the backslash:

console.log({ description: "this is a backslash \\ here" });

Google does do its own post processing of the strings it sees. eg it will most likely remove any html and some emojis.

And sometimes even Google has a bug in the way they encode/decode that can cause strange outputs.

The only way to know for certain is to test. But I think you will be fine as in this case the encoding is dealt with via json.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM