Question
Can I put an article or section in multiple sections or categories?
Answer
In the Help Center, content is organized in a Home > Categories > Sections > Articles structure. With default functionality, a section can only be in one category and an article can only be in one section.
However, you can display a link to the section or article on the page you'd like it to also be available by customizing the template page for the section or category.
Using the is property, you can code in the reference to display the content in the additional section or category. For more information, see the article: Help Center Templates. To do this, you need the ID of the section or category. This can be found at the end of the section or category URL that you want to add the content to. For example, https://yoursubdomain.zendesk.com/hc/en-us/categories/#######
To add an article to a section
{{#is section.id ######}}
<a href="https://help center article URL without the title">alt text</a>
{{/is}}
To add a section to a category
{{#is category.id ######}}
<a href="https://help center section URL without the title">alt text</a>
{{/is}}
To add an article to the category page within the {{#each section}} helper
{{#is id ######}}<a href="https://help center article URL without the title">alt text</a>
{{/is}}
If you add an article or section to an empty section or category, the process is different and involves incorporating the if/else statement used to display an empty link within the category or section.
For adding an article to an empty section there is an {{#if section.articles}} statement. Within that statement, the {{else}} statement should look like the below script.
{{else}}
{{#is section.id ######}}
<ul class="article-list">
<li class="article-list-item">
<a href="https://help center article URL without the title">alt text</a>
</li>
</ul>
{{else}}
<i class="section-empty">
<a href="{{section.url}}">{{t 'empty'}}</a>
</i>
{{/is}}
{{/if}}
For adding a section to an empty category, the {{else}} statement looks like the below script.
{{else}}
{{#is category.id ######}}
<section class="section">
<h3 class="section-tree-title">
<a href="https://help center section URL without the title">alt text</a>
</h3>
</section>
{{else}}
<i class="category-empty">
<a href="{{category.url}}">{{t 'empty'}}</a>
</i>
{{/is}}
10 Comments
I am trying to use the syntax below in a category template, unsuccessfully. I am unsure where in the page HTML, I should place it. Can someone share an example?
It looks like my colleague is already working with you on a ticket with the same query. Please respond to the existing ticket 😊️
Thank you.
Is it possible to access the "category" object on an "article" page template?
I keep getting errors in the code editor saying I can't access "category". Is there a workaround for this?
This does not work.
Hi Bryan,
Can you provide any additional detail about what you're seeing, what you've tried, etc? We aren't sure how to help troubleshoot without a little more info.
How can I reference two ids to use the same image? This doesn't work and I don't know the right syntax.
<!--2022-->
{{#is id 1##### 2#####}}
<img src="{{asset '2022.png'}}"/>
</a>
{{is}}
Hey, Heather Firth !
The #is helper only allows for two parameters to be present so to have two separate IDs reference the same image, you’ll just need to split the IDs in to two separate #is statements:
I hope this helps! Let me know if you have any questions.
Tipene
I was able to add an article to a section ok, however, the article doesn't show up on the category page so am now trying to also add the article to the section on the category page and am using the below code.
Is this correct, and more importantly, where would I place this? Thanks!
Hi Derek Hixon,
The code looks good to me! You'll want to place that in the category_page.hbs file within the {{each #sections}} helper, which sits below the div with the ID "main-content".
Thanks Tipene Hughes all set now, cheers!
Please sign in to leave a comment.