How to use display Table of Contents in sidebar with arbitrary HTML file?

Here's an example how you could do it with the ReadTheDocs theme from fniessen/org-html-themes. The key bit below is #+SETUPFILE of course.

#+TITLE: My Website
#+SETUPFILE: https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup

* Top-Level Heading
** About Me
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Egestas fringilla phasellus
faucibus scelerisque eleifend donec pretium. Imperdiet proin fermentum leo vel
orci. Habitasse platea dictumst vestibulum rhoncus est. Netus et malesuada fames
ac turpis. Molestie ac feugiat sed lectus vestibulum. Vitae justo eget magna
fermentum iaculis eu non. Proin sed libero enim sed faucibus turpis in eu. Sit
amet consectetur adipiscing elit ut aliquam purus sit amet. Vel pharetra vel
turpis nunc eget lorem dolor sed. Morbi non arcu risus quis varius quam quisque.
Sed nisi lacus sed viverra tellus in hac habitasse. Tortor pretium viverra
suspendisse potenti.


** Coding Exercise
Here's a little C code example that started my journey in the exciting world of
programming.

#+begin_src C
#include <stdio.h>
int main() {
   printf("Hello, World!");
   return 0;
}
#+end_src

Result: org-export website