Publishing with Bookdown - jhudsl/OTTR_Template GitHub Wiki
Bookdown is published using Github pages which you can set up following the set up repository instructions.
As you modify the names of the chapters of your course and add more chapters (using the .Rmd
files), you need to update the _bookdown.yml
file accordingly.
For example let's say that we added another chapter and named the file 03-new_chapter_of_course.Rmd
.
We would update our _bookdown.yml
to look like this:
book_filename: "Course_Name"
chapter_name: "Chapter "
repo: https://github.com/jhudsl/OTTR_Template/ ##Make sure you update this for your GitHub Repo!!
rmd_files: ["index.Rmd",
"01-intro.Rmd",
"02-chapter_of_course.Rmd",
"03-new_chapter_of_course.Rmd", ##Only this is new!
"about.Rmd"]
new_session: yes
delete_merged_file: true
language:
ui:
chapter_name: "Chapter "
output_dir: "docs"
Notice how only one line is different - the one that says 03-chapter_of_course.Rmd",
Be careful about quotation marks: ""
as well as commas: ,
!
Once we do this we can preview the book!
You can do so by typing:
bookdown::serve_book()
in the RStudio Console.
Note that when you run bookdown
it will create an .rds
file; you can generally ignore this file.
You will then see a live version of your book in your RStudio viewer.
Note that When a pull request is merged to main, bookdown::render_book()
will be re-run by the GitHub actions and the results added to main
.