Building This Website in Quarto

Quarto
Python
Author

Cooper Richason

Published

December 1, 2023

Modified

December 6, 2023


It’s common advise that one should write a blog in data science, and it doesn’t take long to figure out why. It’s not an understatement to say that I use blogs on a daily basis to learn and solve problems as a data scientist, and I don’t think I’m alone in this. As such, I’ve been wanting to give back to the community and document my data science journey through a blog and to hopefully help the next person get into data science.

To build my blog, I decided to go with Quarto because of its ease and functionality. For those unfamiliar with the magic that is Quarto, it’s a open-source system that allows you to write content in a Jupyter Notebook or your preferred IDE with Python, Julia, R, or Observable and transform your notebook into countless different formats such as a presentation, dashboard, or website. As a lazy data scientist, that’s just want I need!

Getting Started:

With Visual Studio Code:

If you would like to follow along and create our own blog, I’m using Visual Studio Code and the latest version of quarto, which you can download here. I choose to use VS code because I’m using Python for my website/blog, and it offers native features and support for Quarto documents. If you prefer R to Python, RStudio has similar features for making Quarto projects, and their YouTube channel has tutorials on using Quarto with RStudio.

Then, open VS code, select ‘New File’ on the home screen, and you should be taken to the search bar and see options for the file type. If Quarto is already installed, you will see the option to create a Quarto document or Quarto project. Select quarto project, and then select blog when presented with the project options. Quarto websites and blogs are very similar, but starting with a blog is a bit easier since it will automatically create a listing page, folder to store the posts, and an example blog post for you.

With Quarto’s CLI:

How to create a blog titled ‘myblog’ using Quarto’s CLI:

quarto create-project myblog --type website:blog

Changing the Homepage

By default, blog projects have the post listing page as the home page of the website, but I prefer to have my about page set as my home page. Whatever page you have named index.qmd is the homepage, so by renaming index.qmd to blog.qmd and about.qmd to index.qmd, this swaps the homepage.

Changing the Theme:

Now onto the fun stuff! I’m a very visual person, so getting to choose the theme of my website was the part that I was post looking forward to! Quarto allows you to choose any of the Bootswatch themes, so there are a lot of great options that require very little setup.

I played around with the idea of using the Quartz or Morph theme because of how fun they are, but I ultimeatly decided to gow with Zephyr to be more professional. At somepoint, if I ever have the time to write my own CSS, I’d love to use a glasmorphic design like Quartz with different colors and background.

To set the theme for your website/blog, go to the _quarto.yml file in your main directory, and update theme: cosmos to be your chosen theme.

Small Tweaks:

At this point, you have all the files you need to create your website. I recommend making a post template in your posts folder, and use draft: true so that it is hidden:

If you’re so inclined, you can also change the layout of your blog easily by changing the type: default in your blog’s .qmd file to grid or table. Quarto has a list of other blog parameter’s on their website.

Back to top