moonmeister / wp-graphql-seopress

This is an extension to the WPGraphQL plugin for SEOPress
GNU General Public License v3.0
13 stars 3 forks source link

Create JSON LD using graphql #36

Closed vkalyaanasundaram closed 2 years ago

vkalyaanasundaram commented 2 years ago

I have GraphQL query response as

"proSchemasManual": " [{\"_seopress_pro_rich_snippets_type\":\"faq\",\"_seopress_pro_rich_snippets_faq\": {\"0\":{\"question\":\"what?\",\"answer\":\"YEs\"}, \"2\":{\"question\":\"Who?\",\"answer\":\"Him\"}, \"3\":{\"question\":\"When?\",\"answer\":\"!0am\"}} }]",

I want to generate JSON LD in front end Next.js with

@context, @type, address and etc. proSchema

moonmeister commented 2 years ago

You'll need to take this structured data and create the JSON LD data. There's a react component I've used for this before but don't recall the name.

Apr 28, 2022 9:02:45 AM vkalyaanasundaram @.***>:

I have GraphQL query response as

"proSchemasManual": " [{"_seopress_pro_rich_snippets_type":"faq","_seopress_pro_rich_snippets_faq": {"0":{"question":"what?","answer":"YEs"}, "2":{"question":"Who?","answer":"Him"}, "3":{"question":"When?","answer":"!0am"}} }]",

I want to generate JSON LD in front end Next.js with

@context[https://github.com/context], @type[https://github.com/type], address and etc. [https://user-images.githubusercontent.com/82804146/165783043-cc895651-8914-41ed-a660-cd057026d037.JPG][proSchema][https://user-images.githubusercontent.com/82804146/165783043-cc895651-8914-41ed-a660-cd057026d037.JPG]

— Reply to this email directly, view it on GitHub[https://github.com/moonmeister/wp-graphql-seopress/issues/36], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAU2W555VKPUJMUNG56MO2LVHKSBBANCNFSM5USWYFNA]. You are receiving this because you are subscribed to this thread.[Tracking image][https://github.com/notifications/beacon/AAU2W52Z2JXA3KK3ZISBZ33VHKSBBA5CNFSM5USWYFNKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4SFGO3RA.gif]

DeathCamel58 commented 2 years ago

@moonmeister Is right about this. The structured data is not intended to be valid JSON LD.

On the site I use this for, you can see how I parse this out: https://github.com/DeathCamel58/plumb-all-gatsby/blob/c6171aa7d91480dfe172a79dce7fb06c4bd45110/src/components/seo/SEOPress.js#L135

Hope this helps!