Thanks to Hugo , I am able to create my first website with ease.
I always found building static websites to be really hard for nearly 10 years. There are majorly 3 ways to build static websites:
- Download an available pre-created project in html/css/js and try editing around.
It’s pretty obvious that there will be lot of duplication of files around and without any strong templating engine it would be really hard to maintain the website beyond a certain point. - Use a content management system like wordpress.
I never understood why would someone keep their precious content in a database. With one bad config or an attacker could wipe out your complete database and you will have to struggle with UI and wordpress support to get your content back.
They do support having database backups but just for static websites it doesnt make much sense. - Create website using some templating engine like jekyll and hugo.
These kind of templating engines where you can commit your content in format of markdown inside git is a brilliant idea. I didn’t know about jekyll/hugo before but I always wanted to have a functionality to commit my blog directly to git and have it pushed to my website.
🥜 Hugo in a nutshell
Hugo has 5 major features that I loved:
1. Content in Markdown format
Being a developer, I prefer writing documentation in markdown format, as it is easy to maintain
and render. Personally I am not a big fan of UI and creating documents in markdown is very efficient
and fast for me.
It also supports organizing documents in a folder structure making it one of the best content management
systems
2. Ability to use theme
Hugo has huge list of theming options Hugo Themes
, making the website setup
really easy. All I had to install the theme and the website was up and running in no time.
I chose the Blist theme
as was looking really good.
Another thing to point out here is the theme is added as a git submodule in my project making my code repository
really small, which inturn reduces my initial learling curve to setup the website as there are fewer files
that I need to look at.
3. Ability to easily override themes
Eventually I had to modify few components in the theme, and Hugo had thought of this as well. Instead of modifying the
submodule project, I just had to add the file with same name under layout folder to create the overrides.
These contain few of the overrides for the components present in the theme. Refer
Hugo templating
for more details.
4. Powerful templating engine
Hugo has a really powerful templating engine, which provides all the content and the config file
in form of variables which we can use and iterate on to render our components.
In this example, I am getting all the pages of type blog and rendering them. That’s some really
powerful stuff. Read more about Hugo Variables
.
5. Easy integrations with Disqus, Google analytics etc.
At last I need integrations with disqus, GA, mail chimp and I was able to do that with just 2 lines of code. For disqus i had to add these 2 lines
disqusShortname = 'yourDisqusShortname'
{{ template "_internal/disqus.html" . }}
And I had a comment section running on each page. Read more about it here .
Hugo is the kind of content management system I always wanted for a website. Love the work you are doing, Great job guy 👏👏👏