Add logo to bookdown

Hi,
I created an R bookdown for my research (Hungarian language):

My q is that how can I add a png as logo to the top of the sidepanel like the one at: Introduction | rstudio4edu

Thank you for your help in advance,
Marcell

I believe you want to look at this file:

In particular this line under config and then TOC:


      before: |
        <li class="toc-logo"><a href="./"><img src="images/logo/logo-rstudio4edu.png"></a></li>

2 Likes

Hi,

It works fine. Another problem emerged when I had to change to bookdown.yaml instead of output.yaml. In this environment it doesn't work.

That's how the _bookdown.yaml looks now:

book_filename: "my-book.Rmd"
edit: https://github.com/MarcellGranat/FertilityHUN/edit/master/%s
output_dir: "docs"
sharing:
  github: yes
  facebook: yes
  twitter: yes
  all: no
rmd_files: ["index.Rmd", "Chapter-1.Rmd"]
config:
  toc:
    collapse: section
    before: |
      <img src="logo.png" width="270" height="270">
  sharing:
    github: yes
    facebook: yes
    twitter: yes
    all: no

This configuration should be changed in the output function under bookdown::gitbook

Either if you provide it in the index.Rmd in case you are using only one format, or usually in _output.yaml when you are using multiple format. It should not work if you had this in _bookdown.yaml which is for bookdown behavior configuration, not output format specificiation.

What works for you ?