Hugo Project – Complete Beginner Guide
✅ Same Folder e Hugo Start Korar Rule
Dhoro tumi already ekta folder e acho:
cd my-existing-folder
Ekhon simply run korba:
hugo new site . --force
👉 Important:
-
.mane current folder -
--forcelagbe jodi folder empty na hoy
🔥 Alternative (Recommended Clean Method)
Jodi folder e already file thake (like README, index.html etc), tahole better:
hugo new site temp
Tarpor temp folder er vitorer sob file cut kore main folder e paste kore diba.
✅ Final Structure (Resume + Blog + docs deploy)
resume/
├── content/
│ ├── _index.md
│ ├── about.md
│ ├── contact.md
│ └── blog/
│ └── first-post.md
│
├── layouts/
│ ├── _default/
│ │ ├── baseof.html
│ │ ├── single.html
│ │ └── list.html
│ ├── partials/
│ │ ├── head.html
│ │ ├── header.html
│ │ └── footer.html
│ └── index.html
│
├── static/
│ ├── css/
│ ├── images/
│ └── javascript/
│
├── docs/ (build output)
├── hugo.toml
└── README.md
✅ তুমি এখন কীভাবে কাজ করবে (Step-by-step)
1) Home page fix (404 বন্ধ করতে)
content/_index.md must থাকবে:
content/_index.md
---
title: "Home"
---
2) তোমার HTML template কে Hugo layout এ বসানো
✅ (A) তোমার template এ যদি full page HTML থাকে (head/body সহ)
তাহলে best practice:
-
Template থেকে
<head>অংশ →layouts/partials/head.html -
Navbar/Header →
layouts/partials/header.html -
Footer →
layouts/partials/footer.html -
Body content →
layouts/index.html(home) /layouts/_default/single.html(pages)
3) baseof.html বানাও (সব page এর common wrapper)
layouts/_default/baseof.html
<!doctype html>
<html lang="en">
<head>
{{ partial "head.html" . }}
</head>
<body>
{{ partial "header.html" . }}
{{ block "main" . }}{{ end }}
{{ partial "footer.html" . }}
</body>
</html>
4) Home page layout
layouts/index.html
{{ define "main" }}
<main>
<h1>Hello Home</h1>
<!-- তোমার home template content এখানে -->
</main>
{{ end }}
5) Normal pages layout (about/contact)
layouts/_default/single.html
{{ define "main" }}
<main>
<h1>{{ .Title }}</h1>
{{ .Content }}
</main>
{{ end }}
6) Blog list page layout
layouts/_default/list.html
{{ define "main" }}
<main>
<h1>{{ .Title }}</h1>
<ul>
{{ range .Pages }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</main>
{{ end }}
✅ Static files কোথায় যাবে?
তোমার CSS/JS/Images সব যাবে static/ এ:
-
CSS →
static/css/ -
JS →
static/javascript/ -
Images →
static/images/
HTML এ reference হবে:
<link rel="stylesheet" href="/css/style.css">
<script src="/javascript/app.js"></script>
<img src="/images/logo.png">
✅ hugo.toml (docs build + local server)
hugo.toml
baseURL = "/"
languageCode = "en-us"
title = "Resume"
publishDir = "docs"
publishDir="docs"দিলেhugobuild করলে outputdocs/এ যাবে (GitHub Pages friendly)
✅ Local live server
hugo server -D
✅ GitHub Pages build
hugo
তারপর GitHub repo settings → Pages → Source: /docs select করলেই done.
🚀 2️⃣ Live Server (Localhost-এ দেখতে)
এই command চালাও:
বা fast reload avoid করতে চাইলে:
তারপর browser খুলে যাও:
👉 এটাকেই Hugo-র live server বলা হয়
🧩 4️⃣ Basic Template Code
🔹 layouts/_default/baseof.html
🔹 layouts/index.html (Home)
🔹 layouts/_default/single.html (About, Contact, Blog post)
🔹 layouts/_default/list.html (Blog list)
✍️ 5️⃣ Content Example
content/about.md
content/blog/first-post.md
🌍 6️⃣ GitHub Pages-এ Live করার Complete Command List
✅ Step 1: hugo.toml (MUST)
✅ Step 2: Build site
👉 এতে public/ folder তৈরি হবে
✅ Step 3: public → docs
✅ Step 4: .nojekyll add করো
✅ Step 5: GitHub-এ push
✅ Step 6: GitHub Pages Settings
GitHub → Settings → Pages
-
Source: Deploy from a branch
-
Branch:
developedbyask(বা যেটা আছে) -
Folder:
/docs -
Save
⏳ 1–2 মিনিট wait
🔍 7️⃣ Live Check
এইগুলো browser-এ খুলে দেখো:
CSS খুললে → site ঠিক ✅
না খুললে → baseURL mismatch ❌
🔄 বারবার করতে হবে (যখন update করবে)
✅ এই ৩টা command প্রতিবার update এর পর দিতে হবে
🔹 Step 1: Build site
🔹 Step 2: public → docs
(আগে docs delete করে নতুনটা বানানো)
🔹 Step 3: GitHub-এ push
👉 এতেই update live হয়ে যাবে 🚀
----------------------------------------------------------------------------------
হ্যাঁ, folder path না দিলে just এটা চালাও:
hugo --minify
এতে Hugo default output directory public/ এ build দেবে, আর --minify minified output বানাবে।
একবারের জন্য terminal দিয়েও করতে পারো:
hugo --minify -d dist
এখানে -d মানে destination/output folder।
একবারের জন্য command দিয়েও করতে পারো:
hugo --minify -d .
এখানে -d . মানে current project root।
🎯 Summary (এক লাইনে)
Hugo project একই folder থেকে start হবে,
hugo serverlocal preview দিবে,
hugo --minify → docs → GitHub Pages
এই flow follow করলেই site live হবে।