Week 14: Web design and visualization
This week is a more or less free week to discuss and work on anything from the class that we feel we want/need to go over. The current idea for the week is to go over styling for websites and polishing visualizations.
Reading
Assignment
- Work on website project.
Activities
Workshop: Publishing your website Workshop: Designing websites
Publishing your website on GitHub pages
- See also Resources: Publishing Quarto websites with GitHub Pages
- Documentation for the publish command using the quarto command line interface.
Setting up publish command
- First, make sure all changes are committed on your project.
- Create an empty
gh-pages
branch.git checkout --orphan gh-pages
git reset --hard
git commit --allow-empty -m "Initialising gh-pages branch"
git push origin gh-pages
- Check Settings -> Pages for Source branch on your GitHub repository.
- Ignore
_site/
folder in git- Add
/_site/
to.gitignore
file. - Remove any tracking of
_site/
in git:git rm -r _site
- Add
- Publish through command line:
quarto publish gh-pages
What you should be doing to make changes to your website
- Make the changes in RStudio.
- Render website on your computer to make sure everything works.
git add
andgit commit -m
changes.- Push changes to GitHub main branch:
git push origin main
- Publish changes by pushing to gh-pages branch:
quarto publish gh-pages
Designing Quarto websites
The basic styling of your website is done through HTML theming.
Choose a Quarto theme
- Quarto HTML documents are all based on Bootstrap 5.
- Quarto provides access to 25 Bootswatch themes.
- Change theme in
_quarto.yml
underformat:
Basic customization
- You can make basic changes to the theme in
_quarto.yml
underformat:
. - See basic customization for available options.
Customization with SCSS
- Create fully custom themes with SASS variables through
scss
files. SASS is a superset of CSS (Cascading Style Sheets). - This is done in a
styles.csss
orcustom.scss
file, which is listed undertheme:
in_quarto.yml
. - See Quarto SASS variables for the most likely variables you might want to change.
- See More About Quarto Themes on using SCSS.
Resources: Website design
- Quarto websites are customizable through HTML themes.
- Joel Ross and Mike Freeman, Client-Side Web Development
- Bootstrap 5
- Bootswatch themes
- SASS
- Mozilla Docs, CSS: Cascading Style Sheets