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

Can i force "card view" when sharing a link to the sites console?

Avatar

Level 1

I believe column view is the default for users viewing on desktop... but for certain 'decentralized' authors responsible for very specific items, I would prefer they land on the page in card view to keep things as straightforward as possible. 

fourthWaII_0-1656337597577.png

 

Is there a URL parameter or something I can include in the URL to determine what view option is selected? e.g: http://localhost:4502/sites.html/content/brand/product/internal-resources?view=card

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @fourthWaII ,

You have to extend collectionpage

/libs/granite/ui/components/shell/collectionpage/collectionpage.jsp

This is the default code that sets the view (column view) of the page when it loads:

String targetViewName = getTargetViewName(slingRequest, consoleId);

List viewCache = new ArrayList();
Resource currentView = null;

int i = 0;
for (Iterator it = resource.getChild("views").listChildren(); it.hasNext(); i++) {
	Resource item = it.next();

	if (i == 0 || item.getName().equals(targetViewName)) {
    	currentView = item;
	}

	viewCache.add(item);
}

For more details please visit this article: http://aem-podcast.com/2017/aem-interface/default-views-aem-sites-content-tree/#.Yrm3KOzMJb8
Hope that helps!

Regards,

Santosh

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

Hi @fourthWaII ,

You have to extend collectionpage

/libs/granite/ui/components/shell/collectionpage/collectionpage.jsp

This is the default code that sets the view (column view) of the page when it loads:

String targetViewName = getTargetViewName(slingRequest, consoleId);

List viewCache = new ArrayList();
Resource currentView = null;

int i = 0;
for (Iterator it = resource.getChild("views").listChildren(); it.hasNext(); i++) {
	Resource item = it.next();

	if (i == 0 || item.getName().equals(targetViewName)) {
    	currentView = item;
	}

	viewCache.add(item);
}

For more details please visit this article: http://aem-podcast.com/2017/aem-interface/default-views-aem-sites-content-tree/#.Yrm3KOzMJb8
Hope that helps!

Regards,

Santosh

Avatar

Community Advisor

1. Overlay the /libs/dam/gui/content/assets/jcr:content/views/card and under /apps/dam/gui/content/assets/jcr:content/views/card

2. Add a property sling:orderBefore to the list node , something like below

name: sling:orderBefore String card

3. The XML looks something like this

<views jcr:primaryType=”nt:unstructured”>

<card

jcr:primaryType=”nt:unstructured”

sling:orderBefore=”card”/>

</views>

 

Refer : https://www.nextrow.com/blog/adobe-experience-manager/make-list-view-as-default-view-in-aem-assets (...

You can do the same for card view.

 

Thanks

Himanshu

 

Avatar

Community Advisor

Hi,

There is a cookie, which is responsible for showing card layout, if someone you can inject this cookie from dispatcher/slingFilter based on the IP or usergroup then you will be fine

 

cq-sitescard