Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Identifying mobile and desktop view through HTL

Avatar

Level 7

Hi Team ,

 

I have come across a scenario where I have a component. In that component I have to render same content for desktop and mobile. So the content are repeating twice but it is on purpose to differentiate desktop view and mobile view. But SEO perspective I have been notified thats a violation.. Is there any way I can identify mobile breakpoints (mainly desktop and mobile view ) through htl .

 

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Aem pages are cached on dispatcher so getting the dynamic behaviour with each request of same page with different viewport won’t help you as page will be cached on the first request so it will render same content irrespective of media type on subsequent call. What issue has been raised by SEO team? Is it with same content appearing twice on html? If that the case you can work with display:none with css so that elements doesn’t show up on DOM.

https://www.w3schools.com/css/tryit.asp?filename=trycss_display

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @JakeCham 

 

You can use AEM Design Layout feature to set the breakpoints and in HTL, you can write the markup code, only once.

You can check below article from Adobe documentation

https://experienceleague.adobe.com/docs/experience-manager-learn/sites/page-authoring/responsive-lay...

 

Hope this helps!

Avatar

Level 7

Im using static template with 6.5 SP.. So above way would not be applicable ?

Avatar

Correct answer by
Community Advisor

Aem pages are cached on dispatcher so getting the dynamic behaviour with each request of same page with different viewport won’t help you as page will be cached on the first request so it will render same content irrespective of media type on subsequent call. What issue has been raised by SEO team? Is it with same content appearing twice on html? If that the case you can work with display:none with css so that elements doesn’t show up on DOM.

https://www.w3schools.com/css/tryit.asp?filename=trycss_display

Avatar

Administrator

@JakeCham Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni