Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to generate pages if a url matches a certain pattern

Sutty100
Level 5
Level 5

I am investigating how we might use AEM to front our Ecommerce site. The key advantage I want to get out of this is that AEM allows the merchandisers to customise the look and feel of an ecommerce page without a full deploy of code etc if it is much more than a text change like we have now.

I'm sort of wondering what is the best way to handle things like different category pages for example. There are hundreds of these pages and the way I can see to do it is to create a base page eg /content/store/categories/baseCategoryPage and when somebody hits the url /content/store/categories/bread check to see if that page exists if not use the base category page. I also need each category page to have its own url for SEO reasons 

This seems a sensible approach to me as it does not require every page to be created and maintained but it gives the team the ability to customise a certain category page if they wish to.

However how in AEM can I go about doing this, how can I specify a url pattern eg /content/store/categories/* that maps to this generic category page unless there is a specific page which fully matches the url?

Any thoughts would be great!

1 Accepted Solution
Opkar_Gill
Correct answer by
Employee
Employee

Hi,

using the 404 page is not recommended, as you suggest it is a misuse of the error handler.

In version 5.6 of AEM, I created a servlet that would take in a product ID which would then return the appropriate product page to the user. This would be a better approach than using the 404 functionality.

With AEM 6 and beyond, ecommerce functionality has moved on greatly, please go through [1] which should give you an understanding of how it is implemented in AEM.

Regards,

Opkar

[1]https://docs.adobe.com/docs/en/aem/6-1/administer/ecommerce/concepts.html

View solution in original post

0 Replies
kalyanar
Employee
Employee

You can code this logic in to the 404.jsp. This is the jsp that gets called if any url returns a 404.

This jsp can be overlayed at /apps/sling/servlet/errorhandler/404.jsp

Sutty100
Level 5
Level 5

kalyanar wrote...

You can code this logic in to the 404.jsp. This is the jsp that gets called if any url returns a 404.

This jsp can be overlayed at /apps/sling/servlet/errorhandler/404.jsp

 

Is this best practice? Feels a little like I'm misusing the 404 handler a bit! I can however see that this would work so maybe this is the best approach!

Opkar_Gill
Correct answer by
Employee
Employee

Hi,

using the 404 page is not recommended, as you suggest it is a misuse of the error handler.

In version 5.6 of AEM, I created a servlet that would take in a product ID which would then return the appropriate product page to the user. This would be a better approach than using the 404 functionality.

With AEM 6 and beyond, ecommerce functionality has moved on greatly, please go through [1] which should give you an understanding of how it is implemented in AEM.

Regards,

Opkar

[1]https://docs.adobe.com/docs/en/aem/6-1/administer/ecommerce/concepts.html

kalyanar
Employee
Employee

I misunderstood ur usecase i thnk

I more saw this as specific error page for 404 in specific content tree.

something like http://adobe-consulting-services.github.io/acs-aem-commons/features/errorpagehandler.html

If you want to run this in ur author site, you can use the  catalog based approach in AEM commerce framework as Opkar mentioned. You dont need redirection at all as am hoping in an author , the users would click through links in sites /siteadmin ui to access any page.

Sutty100
Level 5
Level 5

Thanks very much that sounds interesting!  We are on 5.6 at the moment but would most likely look at upgrading to 6.1 for this project.