Table of Content | Community
Skip to main content

Table of Content

  • October 12, 2022
  • 7 replies
  • 0 views

Enrique12
Hey Ifra, I read your few posts, can you help me to add table of content for my articles?

7 replies

Ifra
  • October 12, 2022

Hi Enrique Paul

Glad to hear that you read  my posts :)

You can read my Tip for TOC also:

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

 

And if any confusion feel free to ask.

Thanks


Enrique12
  • Author
  • October 13, 2022

Thankyou, that worked for me.
I have one more query, how can I add external url to my table of content links?


Ifra
  • October 13, 2022

@enrique12,

I have one more query, how can I add external url to my table of content links?

 

Solution:

$(document).ready(function() {
  $("#toc").toc({content:".article-body", headings:"h1,h2,h3,h4,h5,h6"});
  

 // External URL - Start
  $("#toc  li:first-child a").attr("href", "http://www.google.com/");
  $("#toc  li:nth-child(2) a").attr("href", "amazon.com");
  $("#toc  li:nth-child(3) a").attr("href", "yahoo.com/");
  // End
});

 

But, why do you wanna external URL in TOC items? :)

 

 

 


Ifra
  • October 13, 2022

Do you wanna link accordion panel-body  to TOC items, am I right? :)


Enrique12
  • Author
  • October 14, 2022

Thanks and yes you guess that right.😊


Enrique12
  • Author
  • October 18, 2022

I am adding my HTML code and this is not working. Why?


Ifra
  • October 19, 2022

For article's source code:-

Check the box  'Display unsafe content' in the Guide setting > Security section.

 

By the way, HTML always works but you can try this option if uncheck the box in your Guide settings.

 

If issue is not which I mentioned then share complete query.