I have written an ebook with bookdown in a gitbook format. I retrieved the html pages so I can upload it to my personal website.
It works like a charm with one exception. The first time the reader views the ebook, the table of content is not visible on the left side. He must click on the small picto 'toggle sidebar' to make it visible.
Is there a way to make the TOC in the sidebar always visible? If not, how can I make sure it is visible when the user arrives on the ebook at first?
Thanks in advance,
Maxime
cderv
December 28, 2023, 10:26am
2
With gitbook(), the TOC for navigation should be opened by default. Unless the user did hid it at last visit, and this preference will be cached in browser, meaning next visit it will be hidden
See my answer there for a JS trick
opened 08:19PM - 02 Sep 21 UTC
closed 04:37PM - 07 Sep 21 UTC
It sounds like you can't just turn off the sidebar TOC according to the manual?:…
https://bookdown.org/yihui/bookdown/html.html
> There are a few arguments of html_document() that have been hard-coded in gitbook() and you cannot change them: toc = TRUE (there must be a table of contents),
We have a use case where we need to link to individual chapters one at a time _without_ confusing our users by having the TOC on the side -- we don't want them to use that for navigation.
I found this [StackOverflow post](https://stackoverflow.com/questions/57713191/remove-table-of-contents-from-a-r-bookdown-to-pdf-book-or-pdf-document2) and providing arguments like it in an `_output.yml` file but always got a message like:
```
Error in config[["collapse"]] : subscript out of bounds
```
Presumably because TOC collapse option (and perhaps other TOC-related options) are being set anyway?
I would love to be able to just turn off the sidebar TOC completely by providing a `toc = FALSE` argument somewhere.
But secondarily, if there's a way to just have the sidebar TOC tucked away upon a using the url, that would work for our use case as well.
If there IS a way to get rid of the TOC easily, then I would be delighted to know how to do that.
### More context on the use case:
We are trying to post our bookdown rendered course on Coursera in a way that requires minimal maintenance of multiple copies of the course but Coursera is organized by chapters.
But Coursera would like a link to each chapter:
![coursera_attempt](https://user-images.githubusercontent.com/23458084/131910515-ccafc022-bacb-4494-8c36-555259426af8.png)
![plugin](https://user-images.githubusercontent.com/23458084/131910523-d4e60cc3-27c3-46fd-a890-16a709b0fed9.png)
We like our bookdown course that is living on the Github pages and would like it to maintain the same aesthetics and structure and ideally want maintenance to be streamlined (don't want to make a bunch of copies of the same material. But I don't know Java and CSS in order to make this happen) and we just need the TOC gone.
This is my [original issue](https://github.com/jhudsl/DaSL_Course_Template_Bookdown/issues/174), but it has other non-related info on it so maybe its not super informative.
system
Closed
February 11, 2024, 10:26am
3
This topic was automatically closed 45 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.