# TOC on Source theme

**URL:** <https://forum.ghost.org/t/toc-on-source-theme/47891>\
**Category:** Themes\
**Created:** [June 4, 2024, 11:07am UTC](https://forum.ghost.org/t/toc-on-source-theme/47891 "2024-06-04T11:07:05Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![vlavrynovych](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vlavrynovych/32/31432_2.png) [@vlavrynovych](https://forum.ghost.org/u/vlavrynovych)\
**Post date:** [December 17, 2024, 5:42pm UTC](https://forum.ghost.org/t/toc-on-source-theme/47891/16 "2024-12-17T17:42:33Z")

</div>

Hi again @elena018 ,

I returned with updated **version 2.1** of my script

You need to copy it from here: [github gist](https://gist.github.com/vlavrynovych/3f244d0b7e9ea9a861d9427aa76486d1)  
Or from my article: [link](https://lavr.site/en-table-of-contents-ghost-v2/)

Here is example of usage:

```html
<toc title="Table of Contents"
  collapsible="true" 
  show-text="Open" 
  hide-text="Close"
  border-color="#000"
  bg-color="ivory"
></toc>

```

Now it has more parameters in addition to **title** :

- (optional) **collapsible** - adds a show/hide button, border, background and some paddings
- (optional) **show-text** & **hide-text** - allow you to override button name in case where you need it or for other languages
- (optional) **border-color** & **bg-color** - allow you to control the styles. Can accept either color name (like `ivory`) or hash (like `#000` for black)

* * *

As minimum you’ll need `collapsible="true"`. As you see all the rest parameters are optional. I use Show/Hide by default as a button name, `gainsboro` as border color and `aliceblue` as background color

As example of work I updated one of my articles: [4G LTE USB Wi-Fi Modem Review from AliExpress](https://lavr.site/en-4g-wifi-usb/)

So, you can start from this:

```html
<toc title="Table of Contents" collapsible="true"></toc>

```

I hope this version works as you expected

---

_[View the full topic](https://forum.ghost.org/t/toc-on-source-theme/47891)._
