Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

SEO friendly Page name validation

Avatar

Level 2

Is it possible to make validation name authorable? Need to choose between admin.pagename(default) and my custom validation. It needs to be managed by author. Author will provide this information in a separate page template and the value will be used in each page validation name.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @Nusrat_Jahan,

 

I assume you want to force the author to create human readable node/page-name or to generate SEO friendly URL.

 

In such case, instead of breaking into OOTB JS validation, I would suggest to do the following

- Implement a replication pre-processor (https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/replicatio...

- With in that, check if you have custom validation is enabled or not, based on that block or allow the page from being published

 

Justification of this solution would be:

- Readable name or SEO friend URL is mainly the ask for publisher

- Author can anyway go ahead and update the node name (by move operation)

- Keeping the OOTB validation (in page properties) intact

 

See if this solution make sense, please let me know..

 

Thanks    

View solution in original post

3 Replies

Avatar

Community Advisor

hi @Nusrat_Jahan IMO, you can create a scheduled sling job over here which perform the following steps:

1. read the configuration for the page validation

2. your job to execute the service to get all the names of the pages on which this validation needs to be executed.

3. your job to execute the service either to correct the names as per the rules defined in your configuration as in Step 1 or use a report to download and fix it.

 

Report Process

  1. create the report in the downloadable format or print the logs to be viewed by the dev team later on after navigating inside the developer console.
  2. After the report is generated, in the next column add the corrected values and upload it in the system.
  3. the scheduled job or on-demand servlet is executed and the corrections are made.

 

Hope this helps!

Thanks

Avatar

Correct answer by
Community Advisor

Hello @Nusrat_Jahan,

 

I assume you want to force the author to create human readable node/page-name or to generate SEO friendly URL.

 

In such case, instead of breaking into OOTB JS validation, I would suggest to do the following

- Implement a replication pre-processor (https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/replicatio...

- With in that, check if you have custom validation is enabled or not, based on that block or allow the page from being published

 

Justification of this solution would be:

- Readable name or SEO friend URL is mainly the ask for publisher

- Author can anyway go ahead and update the node name (by move operation)

- Keeping the OOTB validation (in page properties) intact

 

See if this solution make sense, please let me know..

 

Thanks    

Avatar

Community Advisor

Yes, I think it is possible. The only thing you need to do is register 2 validators, your custom one and the default one, then based on a "class" or some other sort of flag, the validator will check which validation needs to be triggered against the field is being authored. Then you just need to make sure to add the flag accordingly in the field based on the author selection.

 

See more here: 

https://blogs.perficient.com/2017/11/06/aem-touch-ui-dialog-validation-new-best-practice-use-foundat... 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/custom-validation-for-dial... 

 



Esteban Bustamante