Welcome to stackoverflow!
Using e.g. the inspect feature of Chrome on a bookdown::gitbook you see that the first element in the DOM after <body>
is a <div>
which 'contains' the whole book. This <div>
has multiple classes, one of them is with-summary
and this is the one you'd like to remove.
I think the quickest way to do this is jusing jquery:
Set up an HTML file
header.html
<script>
window.addEventListener("DOMContentLoaded", function(){
$("div").first().removeClass("with-summary");
});
</script>
Include the file in the document header using the YAML option includes
in your
.Rmd
---
title: "My Title"
output:
bookdown::gitbook:
includes:
in_header: header.html
---
After the page load, the jquery function will pick the first <div>
element in the DOM and remove the class. Note that this will hide the sidebar if the user navigates to another chapter, too.