Apply a design to the AEM Sightly template

In this session, you will learn about adding a design to the template. You will use Sightly, because it’s HTML5 and very easy to use.

This is in continuation of my previous blog posts. As usual, I have provided the video and transcripts below. Video can be watched in the Full screen mode. The sample design and package are in my GitHub repository. Let me know what you think.

Let us take a sample design. Assume that following is what your designer came up with.


Now, we need to update the AEM template, so that authors will be able to create pages that look similar to this. You can see some sample texts in the design. The sample text is what authors add in their pages.

For creating any design, you should have a CSS file. Let us see the CSS file first. It’s there in the assets/css location.

First step is to get this CSS in CRX repository (Oak repository). In this case, we have only one file to upload. We can upload it using the CRXDELite itself. In real-time, you may have lots of files to upload to CRX repository. There are many ways to do it. We will see them later.

  1. Go to http://localhost:4502/miscadmin.
    This is a new web console for you. You generally use it for creating pages for designs.
  2. Now go to Designs.
  3. Create a page AEM Company.
  4. Go to CRXDE Lite.
    The page you created is available under the designs folder.
  5. Go to designs > aem-company.
  6. Create an empty file static.css.
    Note that the css name should be static.css.
  7. Expand the file node that you created.
  8. Double-click jcr:data property.
  9. Browse to the CSS location and select it.
  10. Click OK.
    Note that static.css is updated with the css that your designer prepared.
  11. Go to the template we created earlier.
  12. Open body.html.
  13. Update it with the html pages with the html page that your designer provided.
  14. Remove the CSS link. (Assigning the CSS to a page is done at a later stage.)

This is the beauty of Sightly. In earlier versions of AEM, you had to convert the design into JSP, which could be time consuming. Adobe also provides a Brackets extension – a tool for designers. This tool allows designers to work directly with AEM templates. We will explore it later.

  1. Now open the Site Admin.
  2. Under AEM Company, create a new page with name home.
  3. Open the page, the page appears with the sample texts.
    Ideally, that should be removed from the sample page. It’s for authors to fill.
    We have seen how to do it earlier. You need to provide the parsys component for author to add component.
  4. Let us do it in the template.
  5. Remove the sample texts by adding the parsys component.
    <div data-sly-resource="${'content' @ resourceType='wcm/foundation/components/parsys'}"></div>
  6. Remove the sample text for the side content using iparsys.
    <div data-sly-resource="${'side-content' @ resourceType='wcm/foundation/components/iparsys'}"></div>
  7. Note that I changed the name to side-content. This is a mistake that I made in the video.
    The iparsys will not appear propery if you don’t change the name.
  8. Now open the page.

Comments are closed.