How to Create and Publish a Quarto Blog Post

guides
tutorials
Author

Sam M

Published

June 6, 2024

Instructions for Creating and Publishing New Quarto Blog Posts

images/Create-Publish-Quarto-Blog-Post.png

1. Create a New Blog Post:

  • Navigate to the blog directory.
  • Create a new .qmd file for your post. For example, Create-Publish-Quarto-Blog-Post.qmd.

2. Write Your Blog Post:

  • Open the newly created .qmd file.
  • Write your blog content using Quarto markdown.
  • Save the file when you’re done.

3. Add Your Changes to Git:

  • Open your terminal.
  • Navigate to your project directory.
  • Add the new post to git:
git add blog/new-post.qmd

4. Commit Your Changes:

  • Commit the changes with a meaningful message:
git commit -m "Add new blog post about Create-Publish-Quarto-Blog-Post.qmd"

5. Push Your Changes to GitHub:

  • Push the changes to your GitHub repository:
git push origin main

6. Publish Your Blog Post on the Server:

  • SSH into your server where the blog is hosted.
  • Navigate to the project directory on the server.
  • Pull the latest changes from GitHub:
git pull origin main
  • Render the site with Quarto:
quarto render

7. Verify the Blog Post:

  • Open your website in a browser to ensure the new post is live.

Sample Blog Post

---
title: "How to Create and Publish a Blog Post"
date: 2024-06-06
author: "Sam M"
categories: 
    - guides
    - tutorials
tags:
  - first
  - blog
---

## How to Create and Publish a Blog Post

### 1. Create a New Blog Post:
  - Navigate to the `blog` directory.
  - Create a new `.qmd` file for your post. For example, `Create-Publish-Quarto-Blog-Post.qmd`.

### 2. Write Your Blog Post:
  - Open the newly created `.qmd` file.
  - Write your blog content using Quarto markdown.
  - Save the file when you're done.

### 3. Add Your Changes to Git:
  - Open your terminal.
  - Navigate to your project directory.
  - Add the new post to git:
  ```bash
  git add blog/new-post.qmd
  ```

### 4. Commit Your Changes:
  - Commit the changes with a meaningful message:
  ```bash
  git commit -m "Add new blog post about Create-Publish-Quarto-Blog-Post.qmd"
  ```

### 5. Push Your Changes to GitHub:
  - Push the changes to your GitHub repository:
  ```bash
  git push origin main
  ```

### 6. Publish Your Blog Post on the Server:
  - SSH into your server where the blog is hosted.
  - Navigate to the project directory on the server.
  - Pull the latest changes from GitHub:
  ```bash
  git pull origin main
  ```
  - Render the site with Quarto:
  ```bash
  quarto render
  ```

### 7. Verify the Blog Post:
  - Open your website in a browser to ensure the new post is live.

That got a little meta. In a future post, we’ll cover using Python to generate a hero image for the blog post.