Content blocks allow you to display categories, sections and/or articles in a variety of different styles. Like custom blocks and contact blocks, various aspects of the blocks are configurable through theme settings. For example, you can change the number of columns, color palette and image size.
Blocks
Presenting categories in blocks or cards is a popular choice, particularly on the Home page.
Cards
Lists and list groups
Tabs and toggles
By default content blocks are displayed on the Home page, however you can use them anywhere in the help center.
You can display content blocks on the Home page using theme settings.
The following settings, found within the Content blocks setting group, are available in the to use in every theme when customizing content blocks:
Setting | Description |
---|---|
Content blocks style | The style of content blocks to display. |
Content blocks color | The color palette used for content blocks. |
Content blocks background color | The background color applied to the content blocks section. |
Content blocks heading | The heading to display above the content blocks. |
Content blocks columns | The maximum number of columns to display per row. |
Content blocks alignment | The alignment of content within content blocks. |
Content blocks image height | The height (in px) for content block images. |
Select a style from the Content blocks style setting to have the content blocks appear.
To display content blocks on any page in the help center other than the Home page:
-
Select the “Custom template” option from the Content blocks style setting in the Content blocks setting group to ensure that there’s not a conflict with an existing micro-template.
-
Copy the HTML hook below into the position where you’d like the content blocks to appear.
<div class="content-blocks bg-content-blocks" id="content-blocks"> <script type="text/javascript"> document.addEventListener('DOMContentLoaded', () => { new Navigation(document.getElementById('content-blocks'), { collection: Theme.contentBlocks || {}, template: 'content-blocks', templateData: { images: [ "{{settings.content_block_1_image}}", "{{settings.content_block_2_image}}", "{{settings.content_block_3_image}}", "{{settings.content_block_4_image}}", "{{settings.content_block_5_image}}", "{{settings.content_block_6_image}}", "{{settings.content_block_7_image}}", "{{settings.content_block_8_image}}" ], imageHeight: "{{settings.content_block_image_height}}", numberColumns: {{settings.number_content_block_columns}}, alignment: "{{settings.content_block_alignment}}", color: "{{settings.color_content_blocks}}" } }); }) </script> </div>
-
Copy-and-paste your selected pattern micro-template into the bottom of the
footer.hbs
template.