Handling ClientLibs in Page Properties | Community
Skip to main content
Level 6
May 25, 2021
Solved

Handling ClientLibs in Page Properties

  • May 25, 2021
  • 3 replies
  • 1965 views

Hello Community - We are using static template in our project and we would like to load the clientlibs on need basis. i.e. In one page, I need to use 5 clientlibs and other page I will use only 1 clientlib. I wanted to configure the clientlib in the page properties so that it can easily configurable for individual pages created using the template. Not sure if someone has already done this approach and also need a suggestions on loading all the clientlibs available in the page properties to configure.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Asutosh_Jena_

Hi @test1234567 

 

I have seen this approach and you can configure the clientlibs at the page properties i.e. if you want any specific file to be loaded only for the specific pages you can do that at the page level using page properties. Just ensure the correct MIME type is selected while configuring the files on the page properties.

 

CSS:

<link rel="stylesheet" href="somefile.css" type="text/css"/>

JS:

<script type="text/javascript" src="somefile.js"></script>

3 replies

Asutosh_Jena_
Community Advisor
Asutosh_Jena_Community AdvisorAccepted solution
Community Advisor
May 25, 2021

Hi @test1234567 

 

I have seen this approach and you can configure the clientlibs at the page properties i.e. if you want any specific file to be loaded only for the specific pages you can do that at the page level using page properties. Just ensure the correct MIME type is selected while configuring the files on the page properties.

 

CSS:

<link rel="stylesheet" href="somefile.css" type="text/css"/>

JS:

<script type="text/javascript" src="somefile.js"></script>

Level 6
May 25, 2021
@asutosh_jena_ - Thanks for your inputs. Is there a way to get the list of all the clientlibs to populate the dropdown or we can maintain a generic list with the clientlibs along with the MIME type and load the list in the dropdown for user selection?
BrianKasingli
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
May 25, 2021

@test1234567,

You can create static templates for each page template. When a user creates a new page, depending on the static page template they have chosen, only then a unique combination of client libraries will be loaded. 

arunpatidar
Community Advisor
Community Advisor
May 25, 2021

You can include the clientlibs from page properties.

Just make sure you included using inheritance logic to avoid changes on every pages.

To get list of all the clientlibs or filtered list use https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/com/adobe/granite/ui/clientlibs/HtmlLibraryManager.html

 

Arun Patidar