How to make a book with a table of contents on github.io

I have many (about 1000) regular static html pages (book). Each page contains only content, no header, footer or table of contents.
I want to use Jekyll to host them on Github Pages so that each page has a header, footer and a navigation block - a tree-like table of contents for the entire book on the left side of browser. The table of contents is also a prepared html file, common for the entire book.
I have scanned github (search all repositories for _config.yml file) but have not found any similar use of Jekyll.
I want the result to be something like Table of Contents - Rust Cookbook
Is it possible?

What about this?

I have an example using a docs theme.

The sidebar is auto populated with items alphabetically. You could name your pages with numbers like 1-2-my-title.md or to set an order.

Regarding nesting in directories, have a look at Collections in the docs. Then you can have _chapter_1/ with pages inside

and to build the side bar you can reference site.collections.chapter_1 or iterate over all collections alphabetical to get N number of chapters.

You might also like MdBook

Actually built in Rust but you just need to write markdown and YAML.

This is ideal for publishing a book online or documentation

Note the sidebar and that is generated based on the content in src