Recent searches


No recent searches

Table of contents?

Answered


Posted Dec 21, 2021

Hi all, 

maybe I'm missing something too obvious...

I'm trying to get an automatic table of contents on longer articles - like offered by e.g. mediawiki. 
This means: Whenever I have more than 5 headings in the article, I would like to show a table of contents on top of the article. 

Currently we use the HTML and manually add a table of contents to the HTML source code. This is not the most efficient way to handle this. The usage of content blocks will anyway stop this as there will be no full HTML export any more. 

Any ideas how to get this? Or is this an enhancement request? 


3

15

15 comments

@Jakub Kręcisz, you can do this, just follow the steps in this article:

https://support.zendesk.com/hc/en-us/community/posts/4408867942298-Tip-How-to-make-a-Table-Of-Contents-TOC-For-Article-Template

 

Here, the TOC would be shown when your article has headings else not.

 

Thanks

1


Thank you for your code!
I'm looking for possibility to hide TOC if article has no headings or just one. How can I set this up? 

0


Thank you for the above. But, our priorities have changes in the new year, so for now I've been told to back-burner this. Apologies for taking this much of your time.

0


Stephen Kairys

Happy new year to you as well. Glad I could help the theme templates are primarily just HTML with a little Curlybraces explained here in the article I linked. https://support.zendesk.com/hc/en-us/articles/4408839332250-Customizing-your-help-center-theme#topic_h5c_k4w_n3.

I'm a front-end web developer so I edit my theme files locally and use Github to version the theme but that may be overly involved for this single addition. If you follow Ifra Saqlain instructions you can do it all in your browser.

0


Rae - 

Thank you so much. That screen (at a quick glance) looks familiar per what I recall my manager doing. I'll have to take a deeper look after the holidays. Except to ask - what language is the above code written in?

Happy New Year.

0


The above seems to relate to adding a ToC to a single article. However, we'd prefer to add it in one place so that all articles in a brand can use it.

Stephen Kairys The solution Ifra Saqlain provided is not for a single article but an edit to the article template which does allow you to apply the change brand-wide to all articles. This is done under customizing the theme and does require a bit of coding knowledge. Your previous manager likely edited these files in a local code editor. Loads more info on this process can be found here.

I did however notice thanks to your screencap Ifra Saqlain one small step was left off I needed to modify my article_page.hbs file to also include the line:

<div id="toc"></div>

Before the line modified in step 2 (<div class="article-body" id="contents">{{article.body}}</div>)

Thanks for the helpful solution when we switched to the new theme our previous TOC did not function as it had previously and this got me close, now working on styling the list this script outputs.!

0


Hey all,

 Thank you so much for your great contribution in the post. You might check the below post for more confirmation and good results:

https://support.zendesk.com/hc/en-us/articles/4408842914714-Help-center-CSS-cookbook-tiktokdownloaders

Keep visiting for more information.

 Thanks

0


How will I be informed about this ticket? Is there an ETA? Thanks and Happy Holidays.

0


Stephen Kairys: Thanks! This will be a ticket in our internal organization first, not a ticket with Zendesk directly - my assumption is, that our internal ZD development team can solve this. 

Happy Holidays and Happy New Year!

0


Thanks, Kai. Is there a ticket# for the forwarded issue? Happy Holidays.

0


Sign in to leave a comment.

Didn't find what you're looking for?

New post