This is the source code for my personal website and blog, built with Quarto.
Adding a new blog post is straightforward. Follow these steps:
-
Create a New Folder: Navigate to the
posts/directory. Create a new folder for your post. The recommended naming convention isYYYY-MM-DD-your-post-titleto keep content organized.# Example mkdir posts/2024-07-25-my-new-post -
Create an
index.qmdFile: Inside your new post folder, create a file namedindex.qmd. This file will contain your post's content. -
Add Post Metadata (Front Matter): At the very top of your
index.qmdfile, you need to add YAML "front matter" to describe your post. This is essential for Quarto to render it correctly.--- title: "My Awesome New Post" author: "Murali K" date: "2024-07-25" categories: [Tech, Ruby, Tutorial] image: "thumbnail.jpg" # Optional: add a thumbnail image in the same folder ---
-
Write Your Content: Below the
---separator, you can write your post content using Markdown. You can also include code blocks, images, and other elements.
To preview your changes (including new posts) before deploying, you can run a local development server.
-
Open your terminal in the project's root directory.
-
Run the following command:
quarto preview
This will start a local server and open the site in your browser. The server will automatically watch for file changes and refresh the page, so you can see your edits live.
Deployment is fully automated using GitHub Actions. You don't need to build the site manually or manage deployment branches.
How It Works:
- Trigger: The process starts automatically whenever you push a new commit to the
masterbranch. - GitHub Action Workflow: The workflow defined in
.github/workflows/publish.ymlruns. It performs the following steps on a remote server:- Checks out code: It downloads the latest version of your code from the
masterbranch. - Sets up Quarto: It installs the Quarto software.
- Renders Site: It runs
quarto render, which builds the entire website and places the final HTML, CSS, and other assets into a directory named_site. - Publishes to
gh-pages: It takes the contents of the_sitedirectory and pushes them to a special branch namedgh-pages. This branch will only contain the final, built version of your site.
- Checks out code: It downloads the latest version of your code from the
- GitHub Pages Serves the Site: Your repository's GitHub Pages settings are configured to "Deploy from a branch" and point to the
gh-pagesbranch. GitHub automatically serves the files from this branch to your public URL.
In short: Just git push to master, and your site will be live in a minute or two.
Most common customizations are done in the _quarto.yml file.
You can change the light and dark themes for the website. The site is currently configured to default to the dark theme for new visitors.
Find this section in _quarto.yml:
format:
html:
theme:
light: cosmo
dark: darklyYou can replace cosmo and darkly with any other valid Bootswatch theme names.
You can add or remove items from the top navbar by editing the website.navbar.right section in _quarto.yml.
website:
title: "Murali K | Engineer"
navbar:
right:
- about.qmd
- icon: github
href: https://github.com/iamurali
- text: "New Link" # Example new link
href: "https://example.com"If you want to add your own custom styles, you can add CSS rules to the styles.css file in the root directory. These styles will be applied across the entire website.