A block is a reusable piece of content that can be inserted in other articles. A block is also an article (when it comes to Zendesk). But, by applying a special tag, and having it under the "Blocks" Category, we will exclude it from mixing with other articles.
Creating a block
- Add a new article to a "hidden" category (e.g., "Blocks")
- The title can only contain alpha-numeric characters and should not contain spaces (this title is only intended for referencing a block; it will not be displayed on a web page). This must also be a unique string across all of Zendesk. The title will be referred to below as block_name.
- Add content to the body as you expect to see it in an article.
- Save the block article.
- Add label with the format:
- block:block_name, where block_name matches the title of the block article (see step 2 above)
Adding the block to another article
- In the article where you want to include the block, add the following in the HTML code where you want the block to appear:
- <!-- #block="block_name" -->
- replace block_name with the title of the block article you created above in step 2
- Notice the spaces after <!-- and before -->.
- Note: you will only see this appear in the HTML code, not in the Zendesk editor view.
The reason we chose the above syntax is bc in an event that the block name doesn't match the content block or the block does not exist, rendering the parent article with the above line in it, will do no harm as the browser will take it as a comment.