Custom Blocks provide you with a flexible content feature that can be used for a variety of purposes. Once created, these blocks can then be added to any of the landing pages you have on your Stacks site. This article will explain to process to create custom blocks and how to add them to your homepage or any other landing page.
Custom blocks can be created by users with the Contributor, Editor, Moderator, or Administrator role; however, only Moderators and Administrators can publish custom blocks to your Stacks site.
Creating Custom Blocks
- From the Dashboard, click the Custom Blocks tile
- Click Add custom block
-
Title - enter a title for the block
- Note, this title can be made visible to your users/patrons when adding the block to a landing page
- Lanugage - if applicable, select the appropriate Language
-
JavaScript code - add JS code here if you are adding a widget or other content via javascript for the block
- Be sure to only use JS code from trusted sources
-
Body - enter the content you wish to display in the block, this could include text, images, videos, and more
- See the WYSIWYG editor article for more information on formatting options and field functionality
-
Title - enter a title for the block
- Review and adjust any settings in the Publishing workflow if needed
- Click Save
Stacks is not responsible for troubleshooting or resolving issues that are a direct result of incorrect or poorly written JavaScript code. We strongly recommended you thoroughly review and test any JavaScript code before implementing it on your website, or seek help from trusted sources if you are not familiar with JavaScript coding.
Adding a Custom Block to a Landing Page
To add a custom block to a landing page:
- Navigate to the page you wish to add the block to
- Click the Layout tab just below the header
- If needed, add a new section to the landing page, otherwise go to step 4
- To add a new section
- Click + Add section
- A window will open with 3 layout options
- 1 column, the section will be the full width of the content area
- 2 column, the section will be split into two columns both 50% of the content area
- 3 column, the section will be split into three columns, with an additional option to choose between either a 33%/34%/33% split OR a 25%/50%/25% split, select the appropriate option
-
Administrative label, once the column configuration is selected, you will have the option to add this label
- This will only be visible to administrators when in this layout builder view and may be helpful in identifying the type of content being added to the section, especially if you have multiple administrators who manage the site
- Click Add Section
- A window will open with 3 layout options
- Click + Add section
- To add a new section
- In the desired section, click + Add block
- A window will open on the right listing the content that can be added to the section
- Content will be organized by feature type, scroll to the Custom Block section or filter by the block's name in the filter field at the top
- Once found, click the block's Title
- A window will open displaying the current Heading
- By default this will be the Title value entered when the custom block was created, you have 3 options
- Leave the heading as is, by default this will be visible to your users/patrons
- Change the heading name, click into the field and type in a new heading name
-
Hide the heading, if you do not wish to show any heading, click the eyeball icon to the right
- The field (and helper text field below) will then be "greyed-out" and cannot be edited
-
Helper Text, if applicable, enter a short description or instructions to provide guidance to the user/patron
- This will appear as an 'i' icon to the right of the heading, users/patrons can click or hover over the icon to view the helper text
-
Subheading, if applicable, enter a value to display as a subheading
- Sub-Title URL, if applicable, enter the full URL to the page you wish to direct users/patrons to when they click the displayed subheading
- Open in new tab/window, if adding a Sub-Title URL, check this box to open that page in a new browser tab/window
- By default this will be the Title value entered when the custom block was created, you have 3 options
- Click Add Block
- A window will open displaying the current Heading
- A window will open on the right listing the content that can be added to the section
- Scroll to the top of the page, then click Save Layout to save your changes