Selectors in AEM

What is the use of selectors in Sling?

http: //www.resourcePath . .extension selector

I read online docs about using selectors:

  • Some documents say that it is used to respond to caching on a page that cannot be executed using query parameters.

  • While some suggest that Selectors are used to respond to different conditions, using the same resource . For example, we had an implementation where, if the page (cq: page) is the last page in the hierarchy, it should be displayed if you say an html block, and if it is not the last page (that is, if it has child pages) , it should not display the specified block. Here we used a script in the component and added this script name to the URL as a selector based on the condition whether it is the last page or not.

But I'm not sure which one is right.

Thanks in advance for any recommendations.

+6
source share
1 answer

URL-. , , HTTP-/ .

, , .

tree.json

tree.1.json(1 - ) tree.json? depth = 1

tree.2.json - tree.json? depth = 2

, CDN ( ? # ). - (? URL-), . , ( ) .

, ( ):

, , .

, , , Dispatcher ( AEM). . , , -. , , .

, . , , , (cq: page) , , html-, ( , ), . script script URL , , .

, , - :

page.last-page.html

last-page - , . , , - . URL- . :

page.html?last-page=true

, .

Sling () script URL-. , () / . , , . , JSON ( , OOTB AEM, ).

content/mypage.json

JSON- node.

, , JSON . , -

content/mypage.json?tidy=true

, . :

content/mypage.tidy.json

, tidy . , script . , , , .

+7

Source: https://habr.com/ru/post/1015818/


All Articles