3.2 Chapters as Web Pages

As can be seen in _bookdown.yml, the files 00-GettingStarted.Rmd, 01-intro.Rmd, 02-textCode.Rmd, etc., are the major chapter files. These will be the meat of the book or web site. They don’t have to be labeled “00-…” and “01-…”; this was just to make them come out in order in the folder for easy viewing. The .yml file above will determine the order in which they are processed. But, the first file in the .yml file, which is the one that begins the whole process is the index.Rmd file.

When the book is “built” using bookdown in Rstudio, certain default settings, the web page title, the author’s name, etc., is set by the header information found at the top of the index.Rmd file. It also creates the initial “index.html” file which will become the landing page for the web site.

The first few lines of the index.Rmd file can be edited; if you are unsure about what one of the lines does, just leave that one alone for now. Obviously, the title, author, and date lines can/should be edited.

3.2.1 Chapters from *.Rmd Files

The index file and the various chapter files are written as R Markdown files (or, .Rmd files). Open and examine the individual .Rmd files in the downloaded zip file directory in order to get a feel for how to use markdown syntax. For more information and for cheat sheets for markdown syntax see, for example:

I’ve tried to illustrate within the included chapter files some of the typical things one might want to do: like, how to include an image, how to create a table, how to do calculations and print or plot a result, etc. Of course these examples just touch the surface, as can be imagined.

3.2.2 Bibliographies and Footnotes

Making a true bibliography for your web site will likely take some doing, so this isn’t something to worry about in the beginning. However, often times one might want to make a local reference, such as a footnote. To do this, type:

...  end of sentence.^[This is a footnote.]  Then comes the next sentence...

This is also exhibited in one of the included chapter files as well.

3.2.3 Clicking on Build

Having started Rstudio by clicking on bookdown-demo.Rproj and looking around, the actual book is created by finding the Build tab (in the same window pane as the Environment and History tabs) and clicking on it. This simply opens the tab, within which you will find another tab labeled Build Book. When you click on this tab, things will start to happen.

Once the building is over, two folders will be either created or updated: _book and _bookdown_files. The folder _book is the final result. If you open this folder, you’ll find the file index.html. Clicking on this file should open it in your computer’s web browser, and you should see the web site you just created!

Eventually, one can take all the files in the folder _book and transfer them to your new web site’s server. Then you’ll be on the air!



The following chapters will go through some basic techniques used for introducing text, images, table, math, and plots within the web pages.