More than one instance of Table of contents (TOC)

More than one instance of Table of contents.

I have to make table of content for studies - first level, and second level.
Unfortunately I can’t use Bricks builder TOC, because this module can support only one instance.

It would be helpful if I can use many TOC.

Hey,

the underlaying library tha we use (tocbot) only supports one instance per page. Either we need to change the library or the library needs to support this as well, but untill then, there is nothing we can do :frowning:

Matej

1 Like

I make TOC using built in module.
Heading selectors: h2, h3
Styles:

%root% .toc-list .is-active-li > a {
  font-weight: 600;
}

%root% > .toc-list {
  list-style: none;
  
  > li > a {
    font-weight: 600;
    margin-top: 10px;
    margin-bottom: 10px;
	}
}

%root% .toc-list > li > .toc-list > li {
  counter-increment: toccounter;
  
  a {
    padding-left: 15px;
    
    &::before { 
    	content: counter(toccounter) '.'; 
    	font-size: inherit;
    	font-family: inherit;
  	}
  }
}

%root% .toc-list .toc-list-item:last-of-type ul {
  counter-reset: toccounter -1;
}

%root% a {
  text-decoration: none;
  
  &:hover {
    text-decoration: underline;
  }
}

Result: