Demo website

This Quarto website is demo of how we can use unilur for teaching.

You can check the source to adapt to your own needs in the docs folder.1

One real example is this bachelor R intro module for Life Sciences students.

For students, we want to have slides (revealjs) and practicals. In the later, the Quarto documents are using unilur for writing solutions along questions. Solutions are within green boxes that we hide for instructions and reveal when practicals are done. This is acheived by toggling the header variable to true from: show-solution: false

Global options

  • show-solution:
    • true generates solution boxes (ie like format unilur-html+solution).
    • false generates instructions without solutions.
  • collapse-solution:
    • true (the default) for HTML output, all solution boxes are collapsed, students need to click on them to unfolded.
    • false, all solutions are unfolded.
Tip

You can specify per chunk the option unilur-collapse which override the behavior of the global option collapse-solution.

See the examples in practical03

Pre-filled template quarto files

The add-on here is generating Quarto templates that students can download and start filling up. They are .qmd files identical to instructions but where solution chunks are replaced by:

```{r}
# write answer here
```

This is not done by unilur at all, but this some custom setup from regular Quarto Websites

This is stated as type in the main config file _quarto.yml:

project:
  type: website
1  pre-render: create-template-yml.R # key hook before quarto render
  render:
2    - "*.qmd"
    - "!*_answer.qmd"
[...]
1
the key part is calling a R script create-template-yml.R.
2
Render all Quarto docs but not the template where .qmd suffix is replaced by _answer.qmd.

In more details, create-template-yml.R will:

  • Generate the quarto templates.
  • Generate a yaml file from those templates.

Then the custom listing is shaped by the templates-listing.ejs where we specify the table look and appearance.

It is called in the listing page practicals.qmd that first list the practicals (classic listing) then the templates (custom).

Usually, we have projects along practicals, you can add them in line 3:

target_folder <- c("practicals", "projects")

Template headers

Right now, the quarto headers for templates will be formatted as follows:

---
title: "Practical chickens"
date: today
author: "Your name"
format: html
embed-resources: true
---

embed-resources: true because otherwise as a teacher you receive sad HTML without any libs.

The date is reported from original practical, kept as today if set but then the displayed date is 1st January 1970 as seen in practicals.html. We advise setting a meaningful date in ISO8610 format YYYY-MM-DD. If date is missing, the current day is set.

Of note, practicals with a draft: true variable are ignored.

Acknowledgements

Footnotes

  1. The unilur extension lies at the root of the GitHub repo, but a symbolic link is used for the demo website in the sub-folder docs/ and pointed to the repo root _extensions/.↩︎