Hi All,
I have requirement parent page automatically redirect to first child page which is specific template type
How to do in Sightly or need to do in java.
Solved! Go to Solution.
Views
Replies
Total Likes
1,2 – if it is not constant or not to be authorable, isn't that contradictory?
"3.it always get the first child page url ."
- Yeah, handle the logic in your java class!
you can handle this in multiple ways.
1. Using sling framework, make use of redirect feature in the page properties – advance properties and select the page to redirect to a desired location.
2. Using dispatcher rewrite rules, (Note: here you need a code build in order to change the values in future). Example rewrite rule:
# Redirect rule for parents pages navigating to home page RewriteRule "^/(product|product/|product.html|notice|notice/|notice.html|errors|errors/|errors.html|mod|mod/|mod.html|administration|administration/|administration.html|experts|experts/|experts.html|support|support/|support.html)$" / [R,L]
the above rule was written in an intension to redirect all parent level (or level 1 pages) pages, which don't have content to the home page.
3. Using sightly/Java, you can still get a list of child pages and then the redirection needs a script to work, I don't think there is much of a direct approach. Speaking of which, make use of standard HTML meta tag and feed in the values through sightly.
<html> <head> <title>HTML Meta Tag</title> <meta http-equiv = "refresh" content = "3; url = https://www.someabcs.com" /> </head> <body> <p>Redirecting to another URL</p> </body> </html>
in the above html, replace the url with the sightly/sling model returned first child page of your desired template.
These are the things I could think at this moment.
I hope it helps, thank you.
Regards,
Sravan
Hi @B_Sravan ,
Thanks for reply.
1.they don't want to be authorable
2.it is not always constant to add in the rewrite rule.
3.it always get the first child page url .
1,2 – if it is not constant or not to be authorable, isn't that contradictory?
"3.it always get the first child page url ."
- Yeah, handle the logic in your java class!
Views
Likes
Replies
Views
Likes
Replies