Expand my Community achievements bar.

SOLVED

Structured Data Implementation

Avatar

Level 3

Hi All,

 

We are planning add structured data on AEM pages and exploring options in AEM as well as looking for best practices to implement in AEM. Please provide your inputs. 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You can try multiple ways: 

Option 1 : Add new text area filed called in page properties and where content author can directly add the json LD script.  You can also add check box to enable or disable structured data (optional) 

something like as shown below. 

Siva_Sogalapalli_0-1647344115913.png

  • If the script is configured and enabled then load the script within <head> {propertes.jsonldscript} </head> something like this.
  • Challenge: Content authors should have knowledge about script and make sure they are adding proper script.

Option 2: As @BrianKasingli mentioned, you can even try with Experience Fragments.

  • Create a custom component - Author configure required content at dialog level & BE logic to generate JSON-LD script dynamically based on data configured by author & store the script at node level
  • Create new path field at page properties level - author can browser script path/experience fragments path at page properties level.
  • BE logic to read the script location & load the script with in <head> tag.

     Hope this helps you. 

 

 

 

 

 

View solution in original post

7 Replies

Avatar

Level 3

Thanks for the reply @Nitin_laad 

Yea, content fragment is one of the options where we can define the fields required for structured data. Once we take the input from authors, Do you suggest to generate the JSON-LD programatically and store at node level? 

Avatar

Community Advisor

My input is, you can use a Experience Fragments strategy to add reusable-structured-data in your AEM pages. 

Avatar

Level 3

Thanks for the reply @BrianKasingli 

May be I've the same question with experience fragments as well Do we need to develop custom component to store JSON LD script? 

 

As per my understanding, we need to add JSON-LD script with in <head> tag at the page level. So I'm looking for options how we can provide feature for authors where can they can just add data and backend generate script and load at the page level. 

1. We want to avoid authors to take care of the script if possible.

2. exploring options as shown in below example where authors do not worry about the script.

https://simplifiedsearch.net/structured-data-generator/ 

3. Is there a way integrate API to generate Script dynamically. 

4. If we can generate script dynamically or in the worst case assume author takes care of preparing script. in this case, what is the best options to load the script at the page level. etc..

 

 

 

Avatar

Level 1

"As per my understanding, we need to add JSON-LD script with in <head> tag at the page level. "

 

JSON-LD can be in head or body. Perhaps AEM has it's own peculiarity as to where it needs to go though?

 

You can also manually add it into the freeform area in the meta data area if you have that configured, but that would be for manually adding it, not automating. 

Avatar

Correct answer by
Community Advisor

You can try multiple ways: 

Option 1 : Add new text area filed called in page properties and where content author can directly add the json LD script.  You can also add check box to enable or disable structured data (optional) 

something like as shown below. 

Siva_Sogalapalli_0-1647344115913.png

  • If the script is configured and enabled then load the script within <head> {propertes.jsonldscript} </head> something like this.
  • Challenge: Content authors should have knowledge about script and make sure they are adding proper script.

Option 2: As @BrianKasingli mentioned, you can even try with Experience Fragments.

  • Create a custom component - Author configure required content at dialog level & BE logic to generate JSON-LD script dynamically based on data configured by author & store the script at node level
  • Create new path field at page properties level - author can browser script path/experience fragments path at page properties level.
  • BE logic to read the script location & load the script with in <head> tag.

     Hope this helps you.