Hey there, fellow devs! 👋 So, if you're anything like me, you've probably been itching to create your own blog but keep putting it off because, well, life happens. I mean, I spent months dabbling with different frameworks and generators, until I stumbled upon Hugo. Honestly, it changed everything for me!
Why Hugo?
When I first tried setting up my blog, I made the classic rookie mistake of getting too fancy with tech that wasn't really necessary. 😅 Hugo, on the other hand, is light, fast (we're talking millisecond build times), and super simple to use. It might not have all the bells and whistles right out of the box, but trust me, it's perfect for developers who want more control over their content.
Here's what actually worked for me after tons of trial and error:
Step 1: Install Hugo
First things first, install Hugo. You can do it easily on Mac, Windows, or Linux. Just head over to the official Hugo installation guide for detailed instructions. Pro tip: If you're on a Mac, use Homebrew. It’s a lifesaver!
Step 2: Create a New Site
Okay, now for the fun part. 🎉 Run this command to create your new Hugo site:
hugo new site my-awesome-blogThis basically sets up a new directory with the default Hugo structure. One thing I realized after a while was to not mess with the directory structure too much. Keep it clean!
Step 3: Pick a Theme
Picking a theme can be overwhelming. Been there, done that. But Hugo's got a bunch of themes to choose from. My advice: go for something simple to start with. Install one by cloning the theme’s repository into the themes directory. For example:
cd my-awesome-blog/themes
git clone https://github.com/theNewDynamic/gohugo-theme-ananke.gitStep 4: Create Your First Post
Got your theme? Sweet! Now create a new post:
hugo new posts/my-first-post.mdThis creates a new Markdown file where you can start writing. BTW, Markdown is super friendly—perfect for writing without stress! 💪
Step 5: Serve and See Your Blog
Here's where it gets exciting. Move to your site's root directory and run:
hugo server -DThis command serves your site locally. Check it out at http://localhost:1313. Spoiler: it took me hours to debug what was a typo when I first tried this. 🤦♂️
One More Thing...
Deploying can be tricky, but Hugo’s got easy integration with platforms like Netlify. If you’re interested, let me know—I might write a follow-up post on deployment. 😉
That's about it for getting started! Remember, this is based on my personal experience, not official docs, so feel free to correct me in the comments if there's a better approach. Try this out and let me know how it goes! You might enjoy my post on optimizing static sites too!