I’ve created separate CMS collections for Countries, States, and Cities. My Jobs collection has reference fields linking to each of these.
Now I’m trying to add a JobPosting JSON-LD schema using an embed block on my Job Template Page. The problem is, I can’t see any of my location fields (country, state, or city) in the +Add Field dropdown when editing the custom code.
Is there any way to pull data from reference fields (like linked country, state, or city names) inside a custom embed for structured data?
Dynamic embeds can be used with Collection fields to include dynamic data in your JSON-LD schema. To implement this, you can use Collection field references within your custom code embed by using the standard {{ }} syntax. Here’s how it works with JSON-LD:
The Collection field values will automatically populate in your schema when the page loads, allowing you to create dynamic SEO-friendly structured data. Keep in mind that the field references must match exactly with your Collection field names, and the JSON-LD syntax needs to be properly formatted.
Thanks for your time and reply….i already have added multirefence fields for city and state inside job pot cms…… what should i add furtehr in job post CMS collection? please reply in simple words
You would use a nested collection list for each of the multi-ref fields to access those items- but you cannot construct your JSON-LD with collection lists inside.
I recommend you switch to Microdata or RDFa for this-