Hugo is a general-purpose website framework. Technically speaking, Hugo is a static site generator. Here are my notes , I tried three times, the most recent attempt in Dec 2022. …

Version 3

I had another go, it seems I have forgotten a lot. The ananke theme has changed and is now very ugly.

  1. https://gohugo.io/getting-started/quick-start/, from download to publication; remains useful
  2. 40+ Best Completely Free Hugo Themes For 2022, they claim top 40 free, I found elate and educentre
  3. hugo theme: introduction, this is the theme I chose to use, which I found in Hugo’s directory
  4. A hint on directory structures, https://www.jakewiesler.com/blog/hugo-directory-structure
  5. https://merrimanlab.github.io/post/2020-10-15-making-posts/

To create a publication candidate, use hugo with no parameters unless the -t parameter is needed to force a theme. It creates a folder public in the folder containing the config.toml. The target public folder needs to be empty. I run hugo from ./examplesite. There is a bug on the 404 page.

I need to run hugo new from ./examplesite  specifying the name of the markdown file with a relative path. and reference to the theme folder e.g.

hugo new ../content/$lang/blog/${name}.md -t ../..

Draft needs to be false to be pushed into the local server

Version 2

It seemed easy but wasn’t. I was helped by the getting started page again 🤓 My target is a static site on AWS/S3, but it seems I could use git. In fact, I gave up on amazon because they charge extra and complicate the delivery over https.

Version Update

I am writing some code, and this is incredibly useful, it documents how to find the latest release. I wrote a script https://github.com/dfl1955/ubuntu-tools/blob/master/whathugoversion to perform this role, but at my version three, I was using apt to install it. i.e. my script on github, in whathugoversion.

Social Media Buttons

I wanted more and tracked it from ananke via git to tachyons. The list is limited and defined and beyond me to extend. An RSS and Web site icon would be good. Most themes seem to use Tachyons CSS.

Introduction uses icons from fontawesome.com

On themes

As at Version 3, I made a site using introduction, also boosted here, the latter contains instructions on using the git module. I also tried to restore my old version based on ananke. , which remains quite old; I may have lost the development tree.

For version 1, I kept to the trial version, ananke. For version two I found Harbor, Air and Greyscale these are now still available in git

Harbor looks cool, but its install is not simple, it throws an error; there seems to be a missing template somewhere. I found some help in using it.

On Hugo Air,  this is rather fab because of its header picture, I had a problem getting the menu to work. When I rteurned to it in 2022, I made a post exclusively for the Air theme,

Greyscale is still going, I see why I liked it.  @github

AWS & https

For HUGO, the base site is defined with a protocol prefix; if using AWS S3 without cloudfront, it must be HTTP i.e. http. I have a related post on this topic,

GIT

I need to work out how to hold the site in git, the current repo is here, and holds the whole build. Once I am sorted, how to I write the site to git as a backup. I need a resource on on branches and versions. (Perhaps the whole thing is needed because some customisation occurs in the go files).

Hugo Problems

At first the prod site would not display the new image. This is now fixed but I found these HUGO links about static file management.

  1. https://gohugo.io/content-management/static-files/
  2. https://github.com/budparr/gohugo-theme-ananke/issues/176
  3. It might be to do with the generator and the source and target files.

My first go!

Two lessons,

  1. On Ubuntu, don’t use apt-get, at least not on AWS. it’s very old and doesn’t work, use the release code and dpkg
  2. The review function is tightly bound to 127.0.0.1:1313. Best not use AWS as a dev. platform, unless you have a graphic desktop. I am now using virtual box.

Some Links

  1. https://itrendbuzz.com/install-hugo-on-ubuntu/, describes how to install using the release packages & dpkg. The current runes are documented here at howto forge
  2. Can you run a hugo site from an ec2 instance? looks like you need to develop on VB or something and push to $HTML_ROOT. Is this done via git? Or cpio, both or either it would seem. cpio for intra-system, git between systems?
  3. The hugo program CLI documentation, here …
  4. This looks useful. It documents how to download all the themes, and how to make posts and pages, a photo gallery and points at some deployment tools.

Publication

The program call hugo, with or without the -t parameter generates the site which is held in a folder called ./public/, this can be the subject of your favourite copy command to relocate the site in you web server’s html root directory.

Drafts & Public

I have created content using the hugo new posts command, this creates a .md file with the meta data inc. the title and the post content. Content can be edited using your favourite editor, I used vi. I need to work out how to enclose images and hyperlinks at some stage. It also defaults to status draft = true. This can be changed by deleting the parameter line and regenerating the site i.e. running hugo -t $themename.

How to deploy

I found the following hard to find, How to deploy a Hugo Site?

  1. Build it using the instructions here …
  2. Ensure your content files are not draft = true.
  3. Run hugo -t $themename., which will create a ./public directory
  4. Copy the contents of the ./public directory to your html root directory.

BaseURL Parameter

Some of the hyperlinks have this value copied into the URL, this ties the site to the hostname. I wonder why they do this?  gohugo.io – getting-started configuration/ lists the parameters including baseURL, relativeURL and canonifyURL. Today the baseURL should/must be an https name. This thread discusses the use of baseURL and transitioning from dev to prod.

Misc.

There are wordpress converters!

The default RSS  is at BaseURL/index.xml.

8 Replies

  1. I have started again, and retired these comments; I installed using the download & gdebi technique described here.

    1. https://hostadvice.com/how-to/how-to-install-hugo-on-ubuntu-18-04/
    2. https://discourse.gohugo.io/t/beginner-question-how-do-i-replace-the-gargoyles/12720/3
    3. https://inside.getambassador.com/creating-and-deploying-your-first-hugo-site-to-github-pages-1e1f496cf88d, describes how to use git as the file system
    4. I revised all the posts to set draft = false, and made the publish folder using hugo -t ananke from the project home directory.
    5. I have installed the aws client api on my dev vm.  This might allow hugo deploy to work. The manual instricutions for this are at Hugo Deploy on their web site. The first port of call for AWS seems to be Configuring the AWS CLI at AWS.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.