What type of table of contents provides the best UX?

I am experimenting with different types of TOC and I would like some feedback on what works best from an UX perspective.

  • I like the simple sidebar TOC (like here)sidebar widget TOC
  • And the floating side TOC for blog posts (like here)floating side TOC But I am seeing more and more sites that use a collapsible TOC at the top of articles that you have to click on to open (like here). Collapsible TOC This type is smaller and less intrusive for users who don't want a TOC taking the entire page. But I actually missed the TOC the first time a colleague showed me that page as an example.

What are the pros and cons of each type? Does any data on UX or SEO support the use of different types of TOC?