Data 304
Create a github repository. (posible name: data304
)
docs/
folder in the repository.Create an index.html
file in the docs/folder.
After a brief delay, your site will be live.
file: docs/path/file.ext
URL: <username>.github.io/<repo name>/path/file.ext
You can use subfolders to keep your files organized.
A file named index.html
will be served when the folder is accessed.
If you create an account with netlify, you can link it to a github repository and netlify will host your site.
You can configure netlify to serve any folder (not just docs/).
You can server multiple websites from the same repo.
This is how our course website is done.
from commandline: git clone <repo-url>
from RStudio: New Project > Version Control
You can do all of your work in RStudio (or VS Code) now.
Put files for your website in docs/ (or sub-folders of docs). (You can put other files outside the folder if you don’t want them to appear online.)
If generating from a quarto doc, either use
in your YAML header or make sure all the neccesary resources are also in the repositiory.
When you are ready to “publish”, just commit and push the files to GitHub.
You can do this within RStudio or from the commandline.
Instaed of writing HTML, it is easier to create quarto files and render them to HTML – especially when you start adding in R/Python code, graphics, etc.
Here is a simple example for index.qmd
to replace index.html
:
Render this as index.html
and add the HTML file to the repository to have it included in your website.
You can create folders within docs/
(e.g., docs/hw/
, docs/portfolio/
, docs/data/
, etc.) to keep your files organized.
In each folder, you can maintain an index.html
(created from index.qmd
) with links to things in that folder (or elsewhere).
If you are wondering how to include some feature in a quarto document, there is lots of documentation on quarto features.
Quarto has a website project type designed for creating websites. That’s how I do the class website. If you want to learn about that, see
It isn’t required, but it isn’t very hard either.