Search code examples
rknitrbookdown

remove facebook and twitter links in `bookdown` in R, Rmarkdown


I am using the bookdown package in R to write a gitbook, but I don't want the final book to have the sharing links to facebook, twitter. I am using something like this in the YAML

--- 
title: "A Minimal Book Example"
author: "SN"
date: "`r Sys.Date()`"
output: 
  bookdown::gitbook
    gitbook_config:
      sharing:
        facebook: false
        twitter: false
documentclass: book
link-citations: yes
description: "This book ... ."
---

but I am getting an error

Error in yaml::yaml.load(enc2utf8(string), ...) : 
  Scanner error: mapping values are not allowed in this context at line 6, column 19
Calls: <Anonymous> ... yaml_load_utf8 -> mark_utf8 -> <Anonymous> -> .Call
Execution halted

Can anyone help me in setting options in YAML so that no sharing options show up in the final rendering?

thanks! SN


Solution

  • Two mistakes:

    1. You omitted a colon after bookdown::gitbook;
    2. gitbook_config should be config.
    --- 
    title: "A Minimal Book Example"
    author: "SN"
    date: "`r Sys.Date()`"
    output: 
      bookdown::gitbook:
        config:
          sharing:
            facebook: false
            twitter: false
    documentclass: book
    link-citations: yes
    description: "This book ... ."
    ---