ContentBlock

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

  1. Add a new article to a "hidden" category (e.g., "Blocks")
  2. 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.
  3. Add content to the body as you expect to see it in an article.
  4. Save the block article.
  5. Add label with the format:
    • block:block_name, where block_name matches the title of the block article (see step 2 above)
  6. You can add other labels to help describe the block content and boost search relevance of the parent article (optional).
  7. Save the block article.

Adding the block to another article

  1. 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.
  2. This inserts the block in the parent article, and associates the labels from the block article as well.

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.

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request