Set up library

Your library is a selection of blocks, templates, and icons that you predefine for your authors at the project level to help them create their content fast.

Introduction

Creating content is about more than just editing and formatting text. Compelling content is made up of different blocks and is kept consistent with templates and placeholders.

By setting up a library for blocks, placeholders, and icons, you help your authors create the right structure for their documents. You define your library by first creating your blocks and templates, then creating sheets to organize them, and finally adding a configuration for the library linking it all together in the following steps.

  1. Create block documents - Create individual documents for each block under a blocks folder. These documents define the blocks that authors will insert into their documents.
  2. Create a blocks sheet - Create a sheet called blocks under a library folder. The sheet collects all the blocks you have defined for the project.
  3. Create template documents - Create individual documents for each template under a templates folder. Template documents contain required blocks, section breaks, section metadata and metadata blocks that can be reused while building pages based on this template
  4. Create a templates sheet - Create a sheet called templates under the library folder. The sheet collects all the templates you have defined for the project.
  5. Create an icons sheet - Identify the locations of the icons that authors can add to the documents.
  6. Create a placeholders sheet - Refer to Placeholders documentation to set up placeholders as per the project requirements.
  7. Update project config sheet - Update the project configuration with your blocks, templates, and icons.

Create block documents

Blocks are represented by tables within documents. Each document contains one type of block, e.g. cards, columns, hero, etc. Block documents are typically placed within a folder called blocks that itself is typically in a folder called library.

Create a document named after the block. Then simply add a table to it to represent the block.

You can create variants of the same block within the same document to accommodate differences in what the blocks will hold. Two types of variants are allowed.


All the variants of a block will be displayed to the author as individual items under the same block name when inserting content.

Block library metadata

Sometimes the difference between blocks can be nuanced. To help your authors choose the right block, you can add metadata at the end of each block in its own block.

The block heading must be library-metadata and it can have one description content row. The description holds a description that is shown in the block dialog when the author clicks on the information icon.

Create a blocks sheet

Once you have created all of your blocks as documents, you need a central list of all of your blocks. This sheet is typically created in the library folder alongside your blocks folder.

Create a sheet called blocks with two columns name and path.

Enable focal points

If a particular block supports the focal points feature in its client-side code, you can enable this feature for the block.

Please see the document Enabling focal points for details.

Create template documents

With your blocks created you can create template documents made up of blocks that your authors can use to quickly create their documents. Template documents generally contain a full page with required blocks, section-metadata, and metadata blocks. When an author adds the template to the currently opened document, the entire contents of the template will be inserted into the document.

Template documents are typically placed within a folder called templates that itself is typically in a folder called library.

Create a templates sheet

Once you have created all of your templates as documents, you need a central list of all of your templates. This sheet is typically created in the library folder alongside your templates folder.

Create a sheet called templates with two columns key and value.

Create an icons sheet

In addition to structuring content with blocks and templates, authors can also add icons to their content to add visual distinction. To do so, the icons must be added to the library by first creating a list of the available icons as a sheet. This sheet is typically created in the library folder.

Create a sheet called icons with two columns: key and value.

Update project config sheet

Now that you have defined your blocks, templates, and icons, you need to make these available to your project by adding a library tab to your project configuration.

  1. Navigate to your project’s root at https://da.live/config#/{org}/{site}/.
  2. Click the gear icon in the breadcrumbs to edit the project’s configuration.
  3. Add a tab to the configuration sheet called library.
  4. Add the rows for blocks, templates, placeholders, and icons so AEM knows where to find these resources when your authors choose to insert them into their content.
title path format ref icon experience
Blocks https://{path-to-blocks}.json
Templates https://{path-to-templates}.json
Icons https://{path-to-icons}.json :<content>:

Validate library setup

Once you have set up your library, place yourself in the author’s role and edit any document in your project.

  1. Change your view to Content.
  2. Place your cursor where you wish to test your library setup.
  3. Open the tools panel.
  4. Select Blocks.

The blocks dialog opens and shows you what you configured previously. Repeat these steps for templates and icons.