What is the best way to add JSON-LD schema to pages that has a specific component
Hello! I am new to AEM, and I need to figure out how to add schema structured data (in JSON-LD format) to all pages that contain one of our custom components.
I know similar questions have been asked before, but the answers weren't very detailed and a bit unclear. I'd like to know about the different approaches, and which one would be the best/most efficient.
Also it's important to note that we already have a lot of existing pages with this component, so I'm hoping for a solution that'll apply to those pages as well without having to do any re-authoring.
I would also appreciate any links to resources that may be helpful. Thanks!
Edit: One other thing I am confused about, is it incorrect to add the json-ld schema data to the component itself? This seems like it would be a straightforward solution, but no one seems to recommend it.