简体   繁体   中英

Add code to Bookdown gitbook template before TOC

I'm creating a gitbook using bookdown, and the designer wants to put a banner at the top of the book, that is, across the entire page above both the TOC and the chapter text.

If I use the before_body attribute in the YAML, bookdown inserts the code after the TOC, so the banner is only at the top of the chapter. Gitbook doesn't seem to allow for the template: attribute.

Any suggestions for how I can squeeze a line of HTML right after the < body > tag to make my designer happy? :)

I managed to solve this myself--it turns out that although officially the gitbook theme doesn't allow the template: attribute, in practice it does. So I just grabbed the existing template, hard-coded my banner after the < body > tag, and referenced my new template in the YAML. I hope this is helpful for anybody else who runs into this problem!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM