Display 2 levels of sub-sections on the section page
回答済みWe have recently implemented sub-sections into our enterprise guide and have sub-sections listed on the section page template. We would like to modify this to display any nested sub-sections within each sub-section (limiting to 2 levels). Is this possible?
I have not found a way in the section_page.hbs template to identify sub-sections under section.sections.
See below for an example of what we would like to see:
<Section Page>
Section Title
Sub-Section 1
- Article 1
- Article 2
Sub-Section 2
Sub-Sub-Section 1
Sub-Sub-Section 2
-
Hi Robert 👋
Yes this is possible since you are on the Enterprise plan.
You have access to use the Section Object in the Section page{{#if section.articles}} <ul class="article-list"> {{#each section.articles}} <li class="article"> <a href="{{url}}">{{title}}</a> </li> {{/each}} </ul> {{else}} <i class="section-empty"> <a href="{{section.url}}">{{t 'empty'}}</a> </i> {{/if}}
{{#if sections}}
<ul class="section-list">
{{#each sections}}
<li class="section">
<a href="{{url}}">{{name}}</a>
</li>
{{/each}}
</ul>
{{else}}
<i class="section-empty">
<a href="{{url}}">{{t 'empty'}}</a>
</i>
{{/if}} -
Kay,
Thanks for the response. The code you posted for the section_page.hbs will display the following:
Sub-Section 1
- Article 1
- Article 2
However, we would like to display the sections under a sub-section, like:
Sub-Section 2
Sub-Sub-Section 1
Sub-Sub-Section 2However, it will not display the "Sub-Sub-Section..."'s
-
Robert,
Please check out the second part of the code.
It does exactly that.
Edit: I see what you mean, sorry for misunderstanding on my end. It is limited to only direct child sections.- Kay
-
When I attempt to nest the each... I get the error "not possible to access `section` in `section.sections`"
{{#each section.sections}}
<li class="section">
<a href="{{url}}">{{title}}</a>
</li>
{{#each section.sections}}
<li class="section">
<a href="{{url}}">{{title}}</a>
</li>
{{/each}}
{{/each}} -
So is there just no way to do this? We have the same scenario - on the section page (not the category page) we have subsections that only contain further subsections and no articles directly under them. We want those sub-subsections to list under the subsections header but can't figure out how to show them. Did someone figure out how to do it?
-
Hi Sarissa!
We understand your need for this functionality and we marked this conversation as product feedback for review, which means that your input will be aggregated as a part of our Voice of the Customer program that provides customer feedback to our product development teams.
In addition, I encourage you to create a new post in the Guide Product Feedback topic in our community to engage with other users who have similar needs and discuss possible workarounds. Conversations with a high level of engagement ultimately get flagged for product managers to review when they go through roadmap planning.
Specific examples, details about impact, and how you currently handle things are helpful for our product teams to understand the full scope of the need when working on solutions. You may also want to review the Product feedback guidelines and how to write an effective feedback post.
We truly value customer feedback and your voice and votes in the forums help influence future Zendesk functionality.
サインインしてコメントを残してください。
6 コメント