How to design a page having different content for logged in and non-logged in users?

Avatar

Avatar
Validate 1
Level 1
Kamal_Kishor
Level 1

Likes

0 likes

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Give Back
Applaud 5
View profile

Avatar
Validate 1
Level 1
Kamal_Kishor
Level 1

Likes

0 likes

Total Posts

11 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Give Back
Applaud 5
View profile
Kamal_Kishor
Level 1

09-06-2021

We have a requirement to show different content (few links in header section) on a page for logged in and non-logged in users. URL of the page will remain same for both users.

How to design such pages in AEM. How the caching and validation of users would work on each page requests?

 

@asutosh_jena , @Arun_Patidar , @markus_bulla_adobe , @Vijayalakshmi_S , @PulkitJain , @Vaibhavi , @Ritesh_M  

View Entire Topic

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,314 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,314 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

09-06-2021

Hi,

We had a similar requirement, to hide few links(protected links) for an anonymous user.

Our solution was -

1. Create a Sling rewriter (LinkTransformer) to find a protected link (based on cug:repPolicy node ) and add a class(link-protected--hide) and hide link by default

2. On front end side check if a user is logged in and has access to those link then remove the class link-protected--hide

The page is always same and cached.

 

In your case, you can specify those links from page properties and read them directly in the header (no need to create rewriter if changes are not global) and from end based on user type remove the hidden class or add the hidden classes