Displaying subsections in your help center


You canadd subsections(sections in sections) to your help center knowledge base to create more levels of hierarchy, up to six levels deep.


What's my plan?







All Suites

Team, Growth, Professional, Enterprise, or Enterprise Plus










Support with

Guide Professional or Enterprise







Verified AI summary ◀▼
Add subsections to your help center knowledge base for better hierarchy, up to six levels deep. Customize the Copenhagen theme to display subsections on category pages or as blocks. Modify the template code to suit your needs, but note that support for custom code isn't provided. This feature helps organize content, making it easier for users to navigate and find information.




You can add subsections (sections in sections) to your help
center knowledge base to create more levels of hierarchy, up to six levels deep.
By default, the standard Copenhagen theme's section page template displays a list of each
section's subsections. You can modify the theme's code to display subsections using other page
templates or to change the look of the subsections lists.
Note: This
article is provided for instructional purposes only. Zendesk does not support or guarantee
the code. Zendesk also can't provide support for third-party technologies such as
JavaScript, jQuery, or CSS. Post any issues you have in the comments section or try
searching for a solution online or from your favorite AI chat bot.

You can only show the direct subsections of a section. You cannot show multiple levels of
subsections.
This article contains the following examples:
Showing subsections on category pages
Showing sections and subsections as blocks




Showing subsections on category pages

You can update the template to display subsections below each section's articles.

To customize the category page template
In the category page template, insert the following block after <section
class="section">:

{{#if sections}}
&lt;ul class="section-list"&gt;
{{#each sections}}
&lt;li class="section-list-item"&gt;
&lt;a href="{{url}}"&gt;
&lt;span&gt;{{name}}&lt;/span&gt;
&lt;svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
focusable="false"
viewBox="0 0 16 16"
aria-hidden="true"
&gt;
&lt;path
fill="none"
stroke="currentColor"
stroke-linecap="round"
stroke-width="2"
d="M5 14.5l6.1-6.1c.2-.2.2-.5 0-.7L5 1.5"
&gt;&lt;/path&gt;
&lt;/svg&gt;
&lt;/a&gt;
&lt;/li&gt;
{{/each}}
&lt;/ul&gt;
{{/if}}




Showing sections and subsections as blocks

You can customize the Copenhagen theme's category page template to display sections as
blocks.

Similarly, you can customize the sections page template to display subsections as
blocks.

To customize the category page template
In the category page template, replace the <div id="main-content"
class="section-tree"> tag and its contents with the following
snippet:
&lt;ul class="blocks-list"&gt;
{{#each sections}}
&lt;li class="blocks-item"&gt;
&lt;a href='{{url}}' class="blocks-item-link"&gt;
&lt;h4 class="blocks-item-title"&gt;{{name}}&lt;/h4&gt;
&lt;p class="blocks-item-description"&gt;{{excerpt description}}&lt;/p&gt;
&lt;/a&gt;
&lt;/li&gt;
{{/each}}
&lt;/ul&gt;


To customize the sections template
In the sections page template, replace the {{#if section.sections}}>
block and its contents with the following
snippet: {{#if section.sections}}
&lt;section class="sections blocks"&gt;
&lt;ul class="blocks-list"&gt;
{{#each section.sections}}
&lt;li class="blocks-item"&gt;
&lt;a href="{{url}}" class="blocks-item-link"&gt;
&lt;h4 class="blocks-item-title"&gt;{{name}}&lt;/h4&gt;
&lt;p class="blocks-item-description"&gt;{{excerpt description}}&lt;/p&gt;
&lt;/a&gt;
&lt;/li&gt;
{{/each}}
&lt;/ul&gt;
&lt;/section&gt;
{{/if}}




//
const ai_summary_style = document.createElement('style');
ai_summary_style.innerHTML = `#styled-article-body{padding:0 0 0}#article-body #docs-ai-summary{background-color:#f3f3f3;border:1px solid #d3d3d3;padding:10px 10px 6px;margin-bottom:16px}#article-body #docs-ai-summary #docs-ai-summary-toggle{font-size:.9em;font-weight:700;margin-bottom:4px;cursor:pointer;display:flex;justify-content:space-between;align-items:center}#article-body #docs-ai-summary #docs-ai-summary-toggle #up-triangle{margin-left:auto;padding-right:10px;display:none}#article-body #docs-ai-summary #docs-ai-summary-toggle #down-triangle{margin-left:auto;padding-right:10px}#article-body #docs-ai-summary #docs-ai-summary-content{font-size:.9em;padding-left:25px;padding-right:25px;margin-bottom:12px}`;
document.head.appendChild(ai_summary_style);

const toggleAISummary = () => {
const summary = document.getElementById("docs-ai-summary-content");
const upTriangle = document.getElementById("up-triangle");
const downTriangle = document.getElementById("down-triangle");
if (summary.style.display === "none") {
summary.style.display = "block";
upTriangle.style.display = "none";
downTriangle.style.display = "inline";
} else {
summary.style.display = "none";
upTriangle.style.display = "inline";
downTriangle.style.display = "none";
}
};

document.getElementById("docs-ai-summary-toggle").addEventListener("click", toggleAISummary);
//

