Since the recommendation to move designs from /etc/designs to /apps/settings/wcm/designs I would like to know what the preferred approach to making a request to an image in that design from HTL
eg we have two designs and in both there is a logo.jpg file. We want to be able to swap the design at the page level using the designPath
If we follow the guides in this Designs and the Designer it generates a link with the /apps/settings/wcm.........../logo.jpg Shouldn't this be coming through some kind of proxy like etc.clientlibs? If so how best to structure the design tree and how to reference the image from HTL?
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
We've solved this in a large upgrade project by creating a BindingsValueProvider service akin to com.day.cq.wcm.scripting.impl.WCMBindingsValuesProvider that wraps the currentDesign and the resourceDesign with a DesignWrapper class (implements Design) that overrides getPath() to return the /etc.clientlibs/ proxy-prefixed path instead, for any design paths under /apps/settings/wcm/design.
Views
Replies
Total Likes
You have to convert any CSS, JavaScript and static resources in the Design to a Client Library with allowProxy = true. for eg. check
/libs/settings/wcm/designs/dashboards/static
Restructuring guidance | For any Designs that are managed in SCM, and not written to at run-time via Design Dialogs.
|
Views
Replies
Total Likes
Thanks. I have done some of the movement to proxied clientlibs which works for some of the css and js.
However the area I am really struggling with is how to reference an image in a design from an htl file. what is the actual code?
pre HTL it would be <%= currentDesign.getPath() + "/static/img/icon.gif %>
HTL i would have assumes something like
${currentDesign.path}/static/img/icon.gif
but if the designs are in /apps/settings/wcm/design/project the link generated is /apps/settings/wcm/design/project/static/img/icon.gif
Views
Replies
Total Likes
We've solved this in a large upgrade project by creating a BindingsValueProvider service akin to com.day.cq.wcm.scripting.impl.WCMBindingsValuesProvider that wraps the currentDesign and the resourceDesign with a DesignWrapper class (implements Design) that overrides getPath() to return the /etc.clientlibs/ proxy-prefixed path instead, for any design paths under /apps/settings/wcm/design.
Views
Replies
Total Likes
Mark,
Thanks for this - I think I basically understand.
This does seem to be an omission from the core code. com.day.cq.wcm.api.designer.Design not having a getProxyPath() method
Views
Replies
Total Likes
Nice response Mark - thank you!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies