DEV Community

loading...

How did I make my blog with Hugo and Github Pages?

datsgabs profile image Gabriel Lazcano ・2 min read

Link to original article (recommended): https://gabriellazcano.com/blog/my-stack/

Introduction

So I decided to go into blogging, I’ve tried using the common blogging sites but being layed back by the tools they gave me wasn’t appealing at all.

In this post I’m going to be explaining the stack I use to run this site and the things I noticed in the process. I’m going to be updating this page as I’m extending my stack.

The stack

In this project I used one of the best tools for Static Site Generation, Hugo. It’s crazy fast and you can customize almost everything. I know Hugo isn’t the most famous but it’s definitely one the most reliable. For the time being, I haven’t seen much attention to the framework and I would like to start contributing to making it widespread.

Set Up

For setting up your own blog there are two ways, using a theme or creating your own. I tried using a theme but in the end it wasn’t fulfilling my needs. I think that the full customization of the themes can be a 2 sided sword, as modifying really anything is extremely difficult. Even more some themes do not have enough documentation and you have to guess how everything works. I get that themes are convenient for starting your site and for people that don’t want to go through the mess but I felt it as I was feeling before choosing Hugo.

I will, in another occasion, of how to set up a theme in Hugo as, as I mentioned before, is extremely convenient.

You can go through the steps of starting your own site, as I did, in the gohugo.io documentation

Hosting

For the hosting I’m currently using Github Pages. I set it up using a Github Action that automatically builds my site in another branch of the project.

Custom domain

At first I didn’t know anything about how configuring a custom domain, I thought it was really straightforward and it kinda is but I had a huge problem setting it up. You can see how I did it in this other post

Wrap Up

I hope you will find this blog post useful and keep it handy for a quick reference. If you want to learn more about Hugo, web development, tips & tricks, please consider checking my other posts 😁

Happy Coding!

Discussion (2)

Collapse
aregaz profile image
Illia Ratkevych

I was thinking about starting a blog and use Hugo for that as well. I have a couple of questions if you don't mind:

  • hosting a blog in Github Pages requires having a public repo, right? So everybody can see the internals of your site. Does it bring any security issues? Or, since it is all static, it does not matter?
  • how wide is the variety of free themes? Would I have options to pick from? Or the selection of free themes for Hugo is limited?
  • does it have RSS?

And a couple of recommendations:

  • try to change the background color from black to some kind of grey or brownish. Just black is too dark. See the image with an example background.
  • consider adding comments to your site so readers can comment not only here but directly on your site. I think Disqus or its alternatives should work with static sites.

And thanks for sharing. I think adding a new blog is beneficial for the dev community in general and is an interesting thing to do personally.

Collapse
datsgabs profile image
Gabriel Lazcano Author

Yeah, you need to have your repo public for a Github Page to work. As I am using the Github Actions for this I am not sure if you can set your code to be private and build to another public repository. The only repository that has to be public is the one that has the index.html that would be the built page. And yes, I believe it doesn't matter because it is static. Either way they are getting all the content from the page. There is a variety of themes to choose and some are real good. If you want to stand I think you will have to move some things but it's a good place to start. It has a predefined way of building the RSS but you can customize it too.
Thanks for the feedback, I was looking forward to implement a commenting section but not using Disqus because it's too taxing. I want it to host my own with Commento. I might do a blog about it. But currently I don't get any revenue nor have a job to cover the expenses.

Forem Open with the Forem app