Contact blocks, like custom blocks and content blocks, are configurable through theme settings. The style, color palette, images, text, URLs and number of blocks and columns will determine how things look on your help center.
By default contact blocks are displayed on the Home page, however you can use them anywhere in the help center.
You can display contact blocks on the Home page using theme settings.
The following settings, found within the Contact blocks setting group, are available in the to use in every theme when customizing contact blocks:
Setting | Description |
---|---|
Contact blocks style | The style of contact blocks to display. |
Contact blocks color | The color palette used for contact blocks. |
Contact blocks heading | The heading to display above the contact blocks. |
Contact blocks number | The maximum number of contact blocks to display. |
Contact blocks columns | The maximum number of columns to display per row. |
Contact blocks image height | The height (in px) for contact block images. |
Select a style from the Contact blocks style setting to have the contact blocks appear.
To display contact blocks on any page in the help center other than the Home page:
-
Select the “Custom template” option from the Contact blocks style setting in the Contact 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 contact blocks to appear.
<div class="contact-blocks" id="contact-blocks"> <script type="text/javascript"> document.addEventListener('DOMContentLoaded', () => { Util.renderTemplate(document.getElementById('contact-blocks'), 'contact-blocks', Theme.contactBlocks); }) </script> </div>
-
Copy-and-paste your selected pattern micro-template into the bottom of the
footer.hbs
template.
The title, description, URL and image of each block is configurable through theme settings.
Custom actions
Using custom JavaScript on the page, it’s possible to have certain URLs (like those starting with a hash tag) trigger actions.
For example, if you wanted the Web Widget to be hidden by default and then revealed when a user clicks on the Chat with us block, you could configure the block’s URL to be #show-widget
and then add something like the following custom JavaScript code to the Home page template (home_page.hbs
):
<script type="text/javascript">
// Shows the Zendesk Web Widget
function showWebWidget(e) {
zE('webWidget', 'show');
e.preventDefault();
}
document.addEventListener("DOMContentLoaded", function() {
// Hide the Zendesk Web Widget on page load
zE('webWidget', 'hide');
// Add the required event listeners
var links = Array.prototype.slice.call(document.querySelectorAll('a[href="#show-widget"]'));
links.forEach(function(a) {
a.addEventListener('click', showWebWidget, false);
});
});
</script>