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.
- Create block documents - Create individual documents for each block under a
blocksfolder. These documents define the blocks that authors will insert into their documents. - Create a blocks sheet - Create a sheet called
blocksunder alibraryfolder. The sheet collects all the blocks you have defined for the project. - Create template documents - Create individual documents for each template under a
templatesfolder. Template documents contain required blocks, section breaks, section metadata and metadata blocks that can be reused while building pages based on this template - Create a templates sheet - Create a sheet called
templatesunder thelibraryfolder. The sheet collects all the templates you have defined for the project. - Create an icons sheet - Identify the locations of the icons that authors can add to the documents.
- Create a placeholders sheet - Refer to Placeholders documentation to set up placeholders as per the project requirements.
- 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.
- The first or heading row has the block name.
- The subsequent rows contain the block content.
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.
- Visual variants are when different styling is required for the same content within the same block. For example a normally formatted table or a table with graybar effects.
- Visual variants are distinguished by appending the variant name in parenthesis behind the block name in the block heading row. For example
table (default)andtable (graybar). - This variant name in parenthesis is used in the block selector dialog to help the author choose the appropriate block.
- The variant name is appended as a CSS class to the resulting HTML.
- This takes advantage of the block options Edge Delivery Services feature.
- Visual variants are distinguished by appending the variant name in parenthesis behind the block name in the block heading row. For example
- Content variants differ only in the content they hold. For example you might want a Cards (tiles) as well as Cards (home page).
- No additional CSS class is appended to such variants.
- Content variants are distinguished by a document heading ahead of the block table.
- This heading is used in the block selector dialog to help the author choose the appropriate block.
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.
nameis displayed to the author when selecting the block.pathis the link to the block document itself format ofhttps://content.da.live/{org}/{site}/library/blocks/{blockname}
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.
keyis displayed to the author when selecting the template.valuevalue is link to template document in the format ofhttps://content.da.live/{org}/{site}/library/templates/{templatename}
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.
valueis displayed to the author when selecting the icon.keyis in the format::key::and is the text that is inserted into the document representing the icon.iconis the link to the icon file in the format ofhttps://content.da.live/{org}/{site}/{path-to-icon}.svg
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.
- Navigate to your project’s root at
https://da.live/config#/{org}/{site}/. - Click the gear icon in the breadcrumbs to edit the project’s configuration.
- Add a tab to the configuration sheet called
library. - 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.
- Change your view to Content.
- Place your cursor where you wish to test your library setup.
- Open the tools panel.
- Select Blocks.
The blocks dialog opens and shows you what you configured previously. Repeat these steps for templates and icons.