๐Ÿš€ One-Time Setup

# Create new Hugo site
hugo new site sourabhkourav
cd D:\dev\hugo-blog\sourabhkourav

# Initialize Git
git init

# Add PaperMod theme
git submodule add https://github.com/adityatelange/hugo-PaperMod themes/PaperMod

# Connect to GitHub
git remote add origin https://github.com/sourabhkourav/sourabhkourav-blog.git
git branch -M main
git push -u origin main

๐Ÿ“ Creating a New Post

# Step 1 โ€” Create post file
hugo new posts/my-post-title.md

# Step 2 โ€” Open and edit the file
# content/posts/my-post-title.md

Post front matter template:

---
title: "Your Post Title"
date: 2026-03-15
draft: false
description: "Short description for SEO"
tags: ["tech", "coding"]
categories: ["Tech"]
cover:
    image: "/images/cover.jpg"
    alt: "cover image"
---

Your content here...

๐Ÿ“„ Creating a New Page (with Menu)

# Step 1 โ€” Create page file
hugo new contact.md
hugo new uses.md
hugo new now.md

Step 2 โ€” Open hugo.toml and add to menu:

[[menu.main]]
  name = "Contact"
  url = "/contact/"
  weight = 3

[[menu.main]]
  name = "Uses"
  url = "/uses/"
  weight = 4

Step 3 โ€” Push to deploy:

git add .
git commit -m "add contact page"
git push

โœ๏ธ Draft โ†’ Preview โ†’ Publish Workflow

# Step 1 โ€” Create post (draft: true by default)
hugo new posts/my-post-title.md

# Step 2 โ€” Preview draft locally
hugo server -D
# Open http://localhost:1313 to see draft

# Step 3 โ€” When happy, open the .md file
# Change draft: true โ†’ draft: false

# Step 4 โ€” Preview again without drafts
# (exactly like live site)
hugo server

# Step 5 โ€” Publish
git add .
git commit -m "publish: my post title"
git push

๐Ÿ“… Schedule a Future Post

# Step 1 โ€” Create post with a future date
hugo new posts/my-future-post.md

Set a future date in front matter:

---
title: "My Future Post"
date: 2026-04-01
draft: false
---
# Step 2 โ€” Preview future posts locally
hugo server -D -F

# Note: Cloudflare will only show it
# after the date passes automatically

๐Ÿšข Daily Publish Workflow

# Stage all changes
git add .

# Commit with message
git commit -m "new post: your post title"

# Push to GitHub (auto-deploys to Cloudflare in ~30 sec)
git push

๐Ÿ–ผ๏ธ Images

# Step 1 โ€” Put image in static/images/ folder
# Example: static/images/my-photo.jpg

# Step 2 โ€” Use in post content
![Alt text](/images/my-photo.jpg)

# Step 3 โ€” Use as cover image (in front matter)
cover:
    image: "/images/my-photo.jpg"
    alt: "description of image"
    caption: "optional caption"
    relative: false

โš™๏ธ hugo.toml Common Changes

# Change site title
title = "Sourabh Kourav"

# Change description
description = "Tech, Life & Finance โ€” by Sourabh Kourav"

# Add new menu item
[[menu.main]]
  name = "Contact"
  url = "/contact/"
  weight = 3

# Toggle features
ShowReadingTime = true
ShowShareButtons = true
ShowCodeCopyButtons = true
ShowBreadCrumbs = true

# Add Google Analytics
[services]
  [services.googleAnalytics]
    id = "G-XXXXXXXXXX"

# Update base URL when domain is bought
baseURL = "https://sourabhkourav.dev/"

๐Ÿท๏ธ Tags & Categories

# Add to post front matter
tags: ["python", "tutorial"]
categories: ["Tech"]

# Auto-generates pages at:
# sourabhkourav.pages.dev/tags/python
# sourabhkourav.pages.dev/categories/tech

๐Ÿ”„ Update Theme

# Update PaperMod to latest version
git submodule update --remote themes/PaperMod
git add .
git commit -m "update PaperMod theme"
git push

๐Ÿ—‘๏ธ Delete a Post or Page

# Simply delete the .md file
del content\posts\my-post.md

# Then push
git add .
git commit -m "remove post: title"
git push

๐Ÿ“‹ Git Reference

# Check status of changed files
git status

# See commit history
git log --oneline

# Undo last commit (keeps changes)
git reset --soft HEAD~1

# Pull latest from GitHub
git pull

๐Ÿ“ Folder Structure

sourabhkourav/
โ”œโ”€โ”€ content/
โ”‚   โ”œโ”€โ”€ posts/          โ† blog posts
โ”‚   โ””โ”€โ”€ about.md        โ† standalone pages
โ”œโ”€โ”€ static/
โ”‚   โ””โ”€โ”€ images/         โ† all images go here
โ”œโ”€โ”€ themes/
โ”‚   โ””โ”€โ”€ PaperMod/       โ† never edit this!
โ””โ”€โ”€ hugo.toml           โ† site config
What URL
Live Blog https://sourabhkourav.pages.dev
GitHub Repo https://github.com/sourabhkourav/sourabhkourav-blog
Local Preview http://localhost:1313
Cloudflare Dashboard https://dash.cloudflare.com
Hugo Themes https://themes.gohugo.io
PaperMod Docs https://github.com/adityatelange/hugo-PaperMod/wiki

โš ๏ธ Important Rules

  • Never edit anything inside themes/ folder
  • Always set draft: false before publishing
  • Images always go in static/images/ folder
  • Run hugo server -D to preview before pushing
  • When you buy sourabhkourav.dev update baseURL in hugo.toml