Hi All,
I am looking for a solution to rewrite outgoing URLs of certain pages conditionally. Content setup is
/content
/common
/contactus.html
/privarypolicy.html
/careers
/ukpositions.html
/indiapositions.html
/research
/article1.html
/article2.html
/Products
/product1.html
/product2.html
/Services
/service1.html
/service2.html
1. Product and Services section have their own themes
2. Products and Services pages will have links to pages under /common, /careers and /research which are common pages.
3. If user navigates to a common page then page should inherit theme from the source section /Products or /Services. Any further navigation to another common page should also use the same theme.
Some challenges
1. Using HTTP_REFERRER would not work beyond 1st navigation
2. It has to be a Non JS solution
My thought is to do URL rewrites based on content path i.e. if a link to a common page is rendered on a page underneath /Products then i append a selector .products and similarly if if a link to a common page is rendered on a page underneath /Services then i append a selector .services. Then i can have selector scripts for common page templates and include respective design css.
However what i am not clear is what is a clean solution to do this URL rewrite without having to modify individual components that render these links.
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Your structure really limits you on your options to execute your use case.
To follow along with your selector idea, not only would you need to look at your themed pages and add a selector when you have a link to a common page, but when rendering a common page you would need to look at the selector and then render any links on the common page that leads to other common pages with the same selector.
To do link re-writing AEM incorporates an rewrite pipeline process. Once a page is rendered it sends the page through this pipeline process where it rewrites broken links. You can add a service to this "default" pipeline where you can then make additional changes to the links.
Here's some documentation
A Blog Post From an implementor
And Adobe has some limited documentation which for some bizarre reason they hid in the dispatcher docs
As a future consideration your site structured could be improved by doing a livecopy of your common pages so that there is a livecopied instance of these pages beneath each of the Products and Services structures. They would just inherit the design that you set at the top level and they would be centrally managed from blueprint.
Views
Replies
Total Likes
Create an OSGi that can re-write links. You can place application logic in your OSGi to use conditions.
Views
Replies
Total Likes
Your structure really limits you on your options to execute your use case.
To follow along with your selector idea, not only would you need to look at your themed pages and add a selector when you have a link to a common page, but when rendering a common page you would need to look at the selector and then render any links on the common page that leads to other common pages with the same selector.
To do link re-writing AEM incorporates an rewrite pipeline process. Once a page is rendered it sends the page through this pipeline process where it rewrites broken links. You can add a service to this "default" pipeline where you can then make additional changes to the links.
Here's some documentation
A Blog Post From an implementor
And Adobe has some limited documentation which for some bizarre reason they hid in the dispatcher docs
As a future consideration your site structured could be improved by doing a livecopy of your common pages so that there is a livecopied instance of these pages beneath each of the Products and Services structures. They would just inherit the design that you set at the top level and they would be centrally managed from blueprint.
Views
Replies
Total Likes