Hugo

Description

This plugin enables you generate a static website using Hugo in a pipeline.

Source Code: https://github.com/go-vela/vela-hugo

Registry: https://hub.docker.com/r/target/vela-hugo

Usage

NOTE:

Users should refrain from using latest as the tag for the Docker image.

It is recommended to use a semantically versioned tag instead.

Sample of building a site:

steps:
  - name: hugo
    image: target/vela-hugo:latest
    pull: always
    parameters:
      theme_name: hugo-theme-learn

Sample of building a site using the docsy theme:

steps:
  - name: hugo
    image: target/vela-hugo:latest
    pull: always
    parameters:
-     theme_name: hugo-theme-learn
+     theme_name: docsy

Sample of building a site using a custom version of Hugo:

steps:
  - name: hugo
    image: target/vela-hugo:latest
    pull: always
    parameters:
      theme_name: hugo-theme-learn
+     version: 0.101.0

Sample of building a site using the extended hugo binary:

NOTE: Some themes may require the extended binary for additional functionality.

steps:
  - name: hugo
    image: target/vela-hugo:latest
    pull: always
    parameters:
      theme_name: hugo-theme-learn
+     extended: true

Sample of using an environment to build the site differently depending on configuration:

NOTE: Please see Hugo documentation for how to configure this properly.

steps:
  - name: hugo
    image: target/vela-hugo:latest
    pull: always
    parameters:
      theme_name: hugo-theme-learn
+     environment: dev

Sample of using multiple themes via configuration file:

NOTE: Please see Hugo documentation for how to configure this properly.

steps:
  - name: hugo
    image: target/vela-hugo:latest
    pull: always
    parameters:
      config_file: config.toml

Parameters

NOTE:

The plugin supports reading all parameters via environment variables or files.

Any values set from a file take precedence over values set from the environment.

The following parameters are used to configure the image:

NameDescriptionRequiredDefaultEnvironment Variables
base_urlhostname (and path) to the root, e.g. http://spf13.com/falseN/APARAMETER_BASE_URL
HUGO_BASE_URL
cache_directoryfilesystem path to cache directoryfalseN/APARAMETER_CACHE_DIRECTORY
HUGO_CACHE_DIRECTORY
content_directoryfilesystem path to content directoryfalseN/APARAMETER_CONTENT_DIRECTORY
HUGO_CONTENT_DIRECTORY
config_directoryfilesystem path to config directoryfalseconfigPARAMETER_CONFIG_DIRECTORY
HUGO_CONFIG_DIRECTORY
config_fileconfig file to use from config directory (supports: json,toml,yaml)falseN/APARAMETER_CONFIG_FILE
HUGO_CONFIG_FILE
draftinclude content marked as draftfalsefalsePARAMETER_DRAFT
HUGO_DRAFT
environmenttarget build environment, located in the config directoryfalseN/APARAMETER_ENVIRONMENT
HUGO_ENVIRONMENT
expiredinclude expired contentfalsefalsePARAMETER_EXPIRED
HUGO_EXPIRED
extendedwhether to use the extended hugo binaryfalsefalsePARAMETER_EXTENDED
HUGO_EXTENDED
futureinclude content with publish date in the futurefalsefalsePARAMETER_FUTURE
HUGO_FUTURE
layout_directoryfilesystem path to layout directoryfalseN/APARAMETER_LAYOUT_DIRECTORY
HUGO_LAYOUT_DIRECTORY
log_levelset the log level for the plugintrueinfoPARAMETER_LOG_LEVEL
HUGO_LOG_LEVEL
output_directoryfilesystem path to write files tofalseN/APARAMETER_OUTPUT_DIRECTORY
HUGO_OUTPUT_DIRECTORY
source_directoryfilesystem path to read files relative fromfalseN/APARAMETER_SOURCE_DIRECTORY
HUGO_SOURCE_DIRECTORY
theme_nametheme to use from theme directoryfalseN/APARAMETER_THEME_NAME
HUGO_THEME_NAME
theme_directoryfilesystem path to themes directoryfalsethemesPARAMETER_THEME_DIRECTORY
HUGO_THEME_DIRECTORY
versionthe version of hugo the plugin should usefalse0.101.0PARAMETER_VERSION
HUGO_VERSION

Template

COMING SOON!

Troubleshooting

You can start troubleshooting this plugin by tuning the level of logs being displayed:

steps:
  - name: hugo
    image: target/vela-hugo:latest
    pull: always
    parameters:
+     log_level: trace
      theme_name: hugo-theme-learn

Below are a list of common problems and how to solve them: