Hugo

create a local Hugo page

download Hugo binary

Download binary or source from https://github.com/spf13/hugo/releases.

create a new local page

hugo new site tmpName
cd tmpName

choose a theme (current theme: learn)

cd themes
wget https://github.com/matcornic/hugo-theme-learn/archive/master.zip; unzip master.zip

or choose a theme from http://themes.gohugo.io/

edit config.toml (using e.g. theme “learn”)

baseURL = "http://USERNAME.pages.jsc.fz-juelich.de/PROJECTNAME"
theme = "hugo-theme-learn-master"
languageCode = "en-us"
title = "MY NICE TITLE"
canonifyurls  = true
[outputs]
home = [ "HTML", "RSS", "JSON"]

create home page

You may create contents using e.g. markdown, html or asciidoc.

vi content/_index.md 
vi contents/_header.md # insert header line above seach dialog here

or

hugo new post/new_post.md

view results

hugo server --buildDrafts

Deploy on JSC GitLab

To deploy the files to the JSC GitLab server, the following steps have to be done:

  1. add your files to a gitlab repository
  2. create .gitlab-ci.yml

create .gitlab-ci.yml

Creating and pushing the following file will use the GitLab Continious Integration feature to generate the html files with hugo and deploy them on the server. The script is executed on a shared docker runner with the tag “linux”.

  1. use the docker image jojomi/hugo which provides a minimal Linux OS with a hugo binary
  2. clone the repository
  3. execute hugo in the repository
  4. copy the generated files (in the public/ directory) to the gitlab server

.gitlab-ci.yml:

pages:
  tags:
  - public-docker
  image: jojomi/hugo
  script:
  - hugo version
  - hugo
  artifacts:
    paths:
    - public