A template for developing university courses using Quarto.
Real Examples:
You will need to understand the basics of the following features of Quarto to make the most of this template. It's worth it!
- Check their initial tutorial
- Then read about Quarto websites
- Check out also Revealjs tutorial to learn how to create modern slides
- Then move on to learn about Quarto projects
There you go. You might be wondering how to put all of this to work. That is precisely why this template exists!
On GitHub:
-
Click on the green button Use this template then Create a new repository.
-
Wait for GitHub to copy the files and run the initial setup (you will see this on the Actions tab).
Locally in your computer:
-
Clone your newly created repository to your computer.
-
Follow the instructions written below in the π§° Dev Setup section.
-
Skip the R or Python setup if you do not plan on working in one of these languages.
Start editing the files:
Here is a guide of the initial files you might want to modify to remove the sections that refer to the template, leaving only what is relevant to developing/updating the material of your course.
-
Start by editing the
README.md
file carefully.- Change the title
- Remove some of the sections
- Edit the Dev Setup instructions to cater to your needs.
-
Add your course code and course name to the web pages
- If you are using VSCode, you can Ctrl + Shift + F (or β + Shift + F if you are on Mac) and replace all occurrences of
MY_COURSE_CODE
andMY_COURSE_NAME
to the code and name of your course, respectively. - Or, you can manually edit those in the following files:
_quarto.yml
2023/index.qmd
helpers/remove-nav.html
- If you are using VSCode, you can Ctrl + Shift + F (or β + Shift + F if you are on Mac) and replace all occurrences of
-
Then move on to
_quarto.yml
. Scan through this file to spot what you want to change. What pages do you want to keep or remove from your website? -
Next, modify the content of
index.qmd
and start working properly on your content pages under2023/*
-
Visualise your changes by running the Quarto website locally:
quarto preview . --render all --no-browser
On top of the setup below, I also recommend you use VSCode as your primary IDE.
π The Python setup
-
Install Python 3.8 or higher on your computer.
-
Create a new
conda
environment:conda create -y -n=venv-my-course python=3.10.8
Never worked with conda environments before? Take some time to read their documentation.
π‘ Pro-tip: replace
my-course
with your course code. Say, for example,venv-ds105
. -
Activate the environment and make sure you have
pip
installed inside that environment:# the exact `activate` command will vary depending on your OS conda activate venv-my-course
π‘ Remember to activate this particular conda
environment whenever you reopen VSCode/the terminal.
- Install required libraries
pip install -r requirements.txt
Now, whenever you open a Jupyter Notebook, you should see the venv-my-course
kernel available.
π The R setup
- Open a terminal and navigate to the root of this repository.
- Ensure you have R version 4.2.2 or higher
- Open the R console in this same directory and install
renv
package:install.packages("renv")
- Run
renv::restore()
to install all the packages needed for this project - Whenever you install a new R package, run
renv::snapshot()
to save it on your renv.
The Quarto setup
-
Install Quarto on your computer.
-
Run the following command to start the website locally:
quarto preview . --render all --no-browser
This will read the instructions from
_quarto.yml
and render the website locally. -
Open your browser and navigate to
http://localhost:<port>/
. That's it!
πΈοΈ Publishing the website
I recommend you set up a GitHub Action for this. Just follow the instructions in the official Quarto instructions.
π‘ This template already comes with a GitHub workflow setup. You can find it in the .github/workflows/publish.yml_ file. You just need to rename it to .github/workflows/publish.yml
(remove the underscore at the end)
β Questions? Suggestions? If you are not sure how to do something with the template or have a suggestion for a new feature, start a discussion.
π Spotted any bugs? Create a new Issue.
πΌοΈ Want to show us your courses? Share a link to your public page on the discussions page or write me an e-mail.