SEO friendly Page name validation | Community
Skip to main content
Level 2
September 5, 2023
Solved

SEO friendly Page name validation

  • September 5, 2023
  • 3 replies
  • 1157 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by A_H_M_Imrul

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/replication/Preprocessor.html)

- 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    

3 replies

ShaileshBassi
Community Advisor
Community Advisor
September 5, 2023

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

A_H_M_Imrul
Community Advisor
A_H_M_ImrulCommunity AdvisorAccepted solution
Community Advisor
September 5, 2023

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/replication/Preprocessor.html)

- 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    

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
September 5, 2023

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-foundation-validation/ 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/custom-validation-for-dialog-field-touch-ui/m-p/274114 

 

Esteban Bustamante