A new site using Hugo
I have just finished setting up a basic site using Hugo, a static site generator written in Go. Being a static site generator, Hugo builds pages when you create content instead of dynamically, when a vistor requests a page. This leads to fast and secure pages that can be hosted anywhere. I stumbled upon Hugo while browsing a random users github pages (I can't remember the name) and the concept seemed ideal for my purposes: A website easy to setup, use, and manage. Hugo advertises to do this and much more, offering many features and possibilities for customization. I am very new to the Hugo universe so all of its features remain to be seen but so far I have been impressed with the ease of setup which I detail below.
Setting up my first site
To setup Hugo, I basically followed the Install Hugo and Quick Start guides found here.
I am currently running Ubuntu 19.04 so to install Hugo I simply download the .deb file from the Hugo github and got the latest version (currently v0.58.3). Once that was done I made a directory where I would store my Hugo websites and initiated a Hugo site.
mkdir ~/sites
hugo new site <SITENAME>
The next step on the guide was to install a theme. I chose to go with the basic Ananke. In order to install, I initiated a git repository in my ~/sites/<SITENAME> directory and added the theme as a submodule in the themes/ananke directory. The submodule is a great way to include a third party project into your own project. Once the theme has been downloaded, tell hugo to use the theme by adding it to the config.toml file.
cd <SITENAME>
git init
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
echo 'theme = "ananke"' >> config.toml
The next step is to add some content. This is easily done by running
hugo new posts/<POST-TITLE>.md
Once the post is created, it'll have some default content that includes the post title, date created, and marks it as a draft. This can easily be edited using any text editor to include the content you like. The last thing to do before testing is to open up config.toml and edit the site name and url.
baseURL = "https://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "ananke"
The site can now be viewed on a local Hugo server before publishing.
hugo server -D
The -D in the command indicates that drafts should be published. The site can be viewed at http://localhost:1313/.
That's it! The Hugo site is basically complete. To push it to a live server, make sure any post that should be published is not marked as a draft and then run
hugo
to build the static pages. When it's complete, the ouput to be uploaded to the live server will be in the public folder.
While trying to customize my own site, I found the Hugo docs to be a bit confusing. Browsing other sources on the web, I came across a blog which was extremely helpful. The blog goes over most of the basics and is a quick way to familiarize yourself with the Hugo ecosystem.