Full Step-by-Step Guide of Install Hugo Using Chocolatey & PowerShell

Table of Contents

This guide will help you

โœ… Install Chocolatey using PowerShell
โœ… Install Hugo using PowerShell
โœ… Create a Hugo Website
โœ… Run & Build Your Hugo Website

๐Ÿ”น Step 1: Open PowerShell as Administrator

  1. Press Win + X and select Windows Terminal (Admin).
  2. If you donโ€™t see “Windows Terminal,” search for PowerShell, right-click, and select Run as Administrator.
  3. Type the following command to check if execution policies allow scripts to run: Get-ExecutionPolicy
  4. If it returns Restricted, change it using: Set-ExecutionPolicy Bypass -Scope Process -Force

๐Ÿ”น Step 2: Install Chocolatey Using PowerShell

Run the following command in PowerShell (Admin):

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

After installation, verify Chocolatey is installed by running:

choco -?

If you see a list of commands, Chocolatey is installed successfully! โœ…

๐Ÿ”น Step 3: Install Hugo Using Chocolatey

Run this command in PowerShell to install Hugo Extended:

choco install hugo-extended -y

After installation, verify Hugo by running:

hugo version

If it displays the Hugo version, youโ€™re good to go! โœ…

๐Ÿ”น Step 4: Create a Hugo Website

Now, letโ€™s create your first website:

  1. Navigate to a directory where you want to create the website (e.g., Documents folder): cd C:\Users\YourUsername\Documents
  2. Create a new Hugo site: hugo new site mywebsite
  3. Move into the site folder: cd mywebsite

๐Ÿ”น Step 5: Install a Hugo Theme

Choose a theme from Hugo Themes. For this example, weโ€™ll use the Ananke theme:

  1. Initialize a Git repository and install the theme: git init git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
  2. Set the theme in the config.toml file: notepad config.toml
  3. Add this line at the top: theme = "ananke"
  4. Save and close the file.

๐Ÿ”น Step 6: Add Content to Your Website

Create a new post:

hugo new posts/my-first-post.md

Edit the post:

notepad content/posts/my-first-post.md

Add some content inside the file, then save and close.

๐Ÿ”น Step 7: Run the Hugo Server Locally

Start the Hugo server:

hugo server -D

The -D flag ensures that draft posts are visible.

Open your browser and go to:

http://localhost:1313

๐ŸŽ‰ You should see your website running locally!

๐Ÿ”น Step 8: Build Your Hugo Website

Once your website is ready, generate the final static site files:

hugo

This will create a public/ folder with all static files.

๐Ÿ”น Step 9: Deploy Your Website Online

Option 1: Deploy to GitHub Pages

Follow the Hugo GitHub Pages Deployment Guide.

Option 2: Deploy to Netlify (Easiest)

Drag and drop your public/ folder onto Netlify.

Option 3: Deploy to Any Web Hosting

Upload the public/ folder to any web hosting service.

๐ŸŽ‰ Final Summary

โœ… Installed Chocolatey Using PowerShell
โœ… Installed Hugo Using PowerShell
โœ… Created a Hugo Website
โœ… Installed and Applied a Theme
โœ… Added Content to the Website
โœ… Previewed the Website Locally
โœ… Built and Deployed the Website

๐Ÿ’ก Now your Hugo website is ready! ๐Ÿš€

Here, you can face some issues so I am letting you know about these issues.

a. Error message “The term ‘git’ is not recognized” means that Git is not installed or not added to the system PATH on your Windows machine.

โœ… Solution: Install Git and Add It to PATH

Step 1: Install Git

Since you are using PowerShell, let’s install Git using Chocolatey:

  1. Open PowerShell as Administrator
    • Press Win + X, then select Windows Terminal (Admin)
    • Or search for PowerShell, right-click, and Run as Administrator.
  2. Install Git using Chocolatey choco install git -y
  3. Wait for the installation to complete. It may take a minute.
  4. Verify Git Installation git --version If you see an output like git version 2.x.x, then Git is installed successfully.

Step 2: Add Git to System PATH (If Not Recognized)

If the git command is still not recognized, follow these steps:

  1. Find Git Installation Path Get-Command git | Select-Object -ExpandProperty Source This will show something like: C:\Program Files\Git\cmd\git.exe
  2. Manually Add Git to PATH
    • Open File Explorer and navigate to: C:\Program Files\Git\cmd
    • Copy this path.
    • Right-click on “This PC” โ†’ Select Properties โ†’ Click Advanced system settings.
    • Under the Advanced tab, click Environment Variables.
    • In the System Variables section, find Path and click Edit.
    • Click New and paste the copied path (C:\Program Files\Git\cmd).
    • Click OK to save changes.
  3. Restart PowerShell and try running: git --version

Step 3: Retry the Hugo Theme Installation

Once Git is installed and working, try running the theme installation command again:

git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke

Final Summary

โœ… Installed Git using Chocolatey
โœ… Verified Git installation
โœ… Added Git to System PATH
โœ… Successfully ran Hugo theme installation

Now, you should be able to proceed with your Hugo website setup. Let me know if you face any more issues! ๐Ÿš€๐Ÿ˜Š

b. Since you’ve installed Git using Chocolatey but it’s still not recognized, it means that the system PATH is not updated yet. Follow these steps to fix it:

โœ… Step 1: Verify Git Installation

  1. Open PowerShell (as Administrator) and run: Get-Command git | Select-Object -ExpandProperty Source If it returns an error, Git is not installed correctly. In that case, manually install it (see Step 2).

โœ… Step 2: Manually Install Git (If Chocolatey Install Didnโ€™t Work)

If git --version is still not working, manually download and install Git:

  1. Open your web browser and go to:
    ๐Ÿ‘‰ Git for Windows Download
  2. Download the 64-bit version.
  3. Run the installer and follow the default installation steps (just keep clicking “Next”).
  4. When prompted, ensure “Add Git to PATH” is selected.

After installation, restart your computer.

โœ… Step 3: Add Git to System PATH Manually

If git is still not recognized after installation, follow these steps:

  1. Open File Explorer and navigate to: C:\Program Files\Git\cmd
    • If Git is installed in a different location, find the correct path.
  2. Copy the Path (C:\Program Files\Git\cmd).
  3. Add Git to PATH:
    • Press Win + R, type sysdm.cpl, and press Enter.
    • Go to the Advanced tab and click Environment Variables.
    • Under System Variables, find Path, select it, and click Edit.
    • Click New, and paste the copied path (C:\Program Files\Git\cmd).
    • Click OK, then Apply, and restart your computer.

โœ… Step 4: Verify Git is Working

After restarting, open PowerShell and run:

git --version

If it shows something like git version 2.x.x, Git is now installed and working! ๐ŸŽ‰

โœ… Step 5: Continue with Hugo Theme Installation

Now, you can retry adding the Hugo theme:

git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke

Final Summary

โœ… Verified Git installation
โœ… Installed Git manually (if needed)
โœ… Added Git to the system PATH
โœ… Restarted the system and confirmed Git is working
โœ… Successfully continued with Hugo setup

Now, Git should work, and you can proceed with your Hugo website! ๐Ÿš€๐Ÿ˜Š

c. Hereโ€™s a dummy content format for MY HOSPITAL NOW (MHN) that you can use when creating a new post in Hugo.

1๏ธโƒฃ Create a New Blog Post for MHN

Run this command in PowerShell inside your Hugo project directory:

hugo new posts/mhn-introduction.md

This will create a new Markdown file inside the content/posts/ folder.

2๏ธโƒฃ Open and Edit the Post

Run:

notepad content/posts/mhn-introduction.md

Now, add the following dummy content for MHN:

---
title: "Welcome to My Hospital Now (MHN)"
date: 2025-02-14T10:00:00+05:30
draft: false
author: "MHN Team"
tags: ["Healthcare", "Medical Tourism", "Doctor Profiles"]
---

## ๐Ÿฅ Welcome to **MY HOSPITAL NOW (MHN)**

### **๐ŸŒ Your Global Medical Tourism Partner**
MY HOSPITAL NOW (MHN) is your **trusted platform** for connecting patients with the right **doctors, hospitals, and medical services** worldwide.

### **๐Ÿ’ก Why Choose MHN?**
โœ” **Find Top-Rated Doctors** โ€“ View verified doctor profiles with credentials and specialties.  
โœ” **Compare Hospitals** โ€“ Get insights into hospital facilities, patient reviews, and treatment options.  
โœ” **Medical Tourism Assistance** โ€“ We help international patients get **hassle-free** medical treatment abroad.  

### **๐Ÿ“Œ Services We Offer**
๐Ÿ”น **Doctor Profiles:** Browse verified doctors specializing in various treatments.  
๐Ÿ”น **Hospital Listings:** Find hospitals with advanced medical facilities.  
๐Ÿ”น **Surgery & Treatment Packages:** Get cost estimates and details on popular surgeries.  
๐Ÿ”น **Consultation & Second Opinions:** Speak to a medical expert online before making a decision.  

### **๐ŸŒŸ Featured Doctors**
๐Ÿ‘จโ€โš•๏ธ **Dr. Pallavi Gupta** โ€“ Senior Homeopath with 10+ years of experience.  
๐Ÿ‘ฉโ€โš•๏ธ **Dr. Anil Sharma** โ€“ Leading Cardiologist in India with 15+ years of expertise.  

### **๐Ÿ“ž Contact Us**
๐Ÿ“ **Location:** New Delhi, India  
๐Ÿ“ง **Email:** contact@myhospitalnow.com  
๐ŸŒ **Website:** [www.myhospitalnow.com](http://www.myhospitalnow.com)  

---
๐Ÿš€ *Helping Patients Find the Best Healthcare Worldwide!*  

3๏ธโƒฃ Save and Preview the Post

  • Save the file (Ctrl + S) and Close Notepad.
  • Start the Hugo server to preview the post: hugo server -D
  • Open your browser and visit: http://localhost:1313
  • You should see the MHN post on your Hugo website! ๐ŸŽ‰

Final Summary

โœ… Created a dummy MHN post with hospital & doctor details
โœ… Edited and formatted the content using Markdown
โœ… Successfully previewed the post using Hugo

Let me know if you want to customize this further! ๐Ÿš€๐Ÿ˜Š

Related Posts

Unlocking the City Stage: Where to Find Meaningful Events in Lucknow

Introduction Finding reliable, up-to-date entertainment options across the city often turns into an exercise in frustration. Residents, students, and visitors frequently struggle with scattered announcements on social…

Read More

Exploring Bihar Through History, Flavors, and Routes: A Heritage Traveler’s Guide

Introduction Planning a trip to eastern India often raises questions about connectivity, transit times, cultural landmarks, and authentic regional experiences. A well-structured Bihar Travel Guide helps visitors…

Read More

Best Knee Hospitals for Knee Replacement Surgery: Patient Care and Hospital Guide

Introduction Persistent knee pain can quietly dismantle everyday life, turning ordinary steps, grocery runs, and restful nights into exhausting battles with joint stiffness. When conservative approaches like…

Read More

Discover Events in Kolkata: Practical Guide to Live Music, Comedy, and Culture

Introduction If you are looking for events in Kolkata, the main challenge is rarely a shortage of things happening; it is finding reliable information that matches your…

Read More

Engineering Predictability: The Real-World Guide to DevOps Training China

Introduction Enterprise engineering teams frequently hit an invisible architectural ceiling. As microservice ecosystems grow, deployments stall behind manual coordination meetings, configuration drift across environments causes recurring outages,…

Read More

Australia PR for Indian Finance and Accounting Professionals: Points Breakdown

Introduction When you clear the final interview for an overseas role, the relief is immediate. However, as an international relocation advisor, I often tell candidates that receiving…

Read More
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x