NOTE: There are 10 toy Topic sections here, expecting that some teachers may want to have one page per week (for a 10 week course). You are encouraged to structure your course however works best for your class. All of your course information could be on a single page, or you might have a different number of topics, or organize weekly, or any other organization that works for you.
TO UPDATE THIS PAGE: Open and edit the topic_1.Rmd file, in the project root, to delete this placeholder text and customize with your own!
Below for a bit more detail…
To make a new page:
Within your website Project, create a new .Rmd (File > New File > R Markdown). Save it to the project root. For this example, let’s say you’ve saved it as new_page.Rmd.
In that .Rmd file, remove everything but the title (which you can change) from the YAML - that’s the top section of the .Rmd, where by default it has title, author, date, etc.
Update the .Rmd to contain whatever you want to have on that page. Don’t know a lot about markdown? Considering switching over to the Visual Editor in RStudio (versions >= 1.4).
Save the .Rmd
Open the _site.yml
file in your Project
Add the information to the YAML navbar section, which will almost always be the text that you want to appear in the navigation bar, and the file name of the knitted html that will be automatically rendered to /docs when you Build your website. That would be new_page.html
for this example (since the .Rmd it is rendered from is new_page.Rmd
). So in the _site.yml
I would need to add this to the navbar section:
- text: "A new page!"
href: new_page.html
Note: YAML is space & indentation specific. Follow the structure that already exists in this template to avoid YAML errors.
How is the website finding the html? Notice in the _site.yml
file, the output_dir
is set to docs
. That means when we press ‘Build website’ (in the Build tab in RStudio), our .Rmd pages are knitted to HTML & sent to the _docs
folder. This is also important because when we deploy the site (make it live), we will want to deploy from that docs folder using GitHub pages.
Take a look at some other pages in this template (Resources, Assignments, etc.) to see the structure, & give it a shot!
The safest thing to do if you don’t want a page to show up is to remove it from the _site.yml
navbar listings. That way, the material on the page still exists as a file in your project, but doesn’t show up on the website – don’t delete a page file unless you are REALLY SURE that you’re never going to want the material on that page ever again.