How to add CSS, Images to a page in CQ5?

Riju Mahna picture Riju Mahna · Feb 12, 2013 · Viewed 8.1k times · Source

I am creating a new template and then a page from SCRATCH in CQ5. But I can't find the option to add my own CSS/images/JS to the page.

I mean a place to add/upload the actual files.

All the tutorials I've seen talk only about creating a template based on an existing template. Is there any tutorial on how to create the page from scratch ?

Answer

David Gorsline picture David Gorsline · Feb 12, 2013

Your CSS and JavaScript go into nodes under /etc/designs/[your project's name]/clientlibs. (Ordinarily, you would set the page property cq:designPath of your content's home page to be /etc/designs/[your project's name] to point to this.) It's common practice to set up a subfolder of clientlibs called default, where your general-purpose style sheets and JavaScript go; you can set up other clientlibs for special-case script and style sheets. The simplest way to incorporate your script and style sheets into your page template is the <cq:includeClientLib> JSP tag.

The Adobe docs on clientlibs will also be useful to you, and explains how to use the tag.