Package hugohelper
import "gitlab.com/zoralab/bissetii/pkg/helpers/hugohelper"
Package hugohelper is for automating Hugo theme module production from Go.
It was designed to assist any cross-compatible Go-Hugo and Go programming language template design interfaces. By facilitating such compatiblitiy, web HTML interfaces can be singularly designed at one place, saving the design time.
Also, it allows Go developers and web designers to work effectively and communicate easily without needing to get confused with all the tools.
Constants
Error messages are the common text used to generate error object
const (
ErrorBadDirectory = "bad directory"
ErrorBadFilepath = "bad filepath"
ErrorCreateFileFailed = "failed to create file"
ErrorMissingContent = "content is empty"
ErrorMissingRootDirectory = "root directory env. variable not declared"
)
Environment variables for configuring the Hugo helpers
const (
// RootDirectory defines the tag for Hugo Theme module root
// directory.
RootDirectory = "HUGO_GO_ROOT_DIRECTORY"
)
Functions
Func GeneratePartials(pathing string, content string) (err error)
GeneratePartials is to generate the Hugo layouts/partials component.
This function systematically generates all partials with automated warning message on the top for Hugo’s consumption. It is designed to be used in Go test codes. This function reads the following environment variables for repository-level configurations:
HUGO_GO_ROOT_DIRECTORY
- the root directory of the Hugo theme module.
The pathing
parameter must be Hugo Theme Module’s compatible
relative pathing to HUGO_GO_ROOT_DIRECTORY
. Example:
layouts/partials/metas/meta.html
.
Func GenerateTOMLData(pathing string, content string) (err error)
GenerateTOMLData is to generate the Hugo data/*.toml file.
This function systematically generates all TOML data file with automated warning message on the top for Hugo’s consumption. It is designed to be used with Go test codes. This function reads the following environment variables for repository-level configurations:
HUGO_GO_ROOT_DIRECTORY
- the root directory of the Hugo theme module.
The pathing
parameter must be Hugo Theme Module’s compatible
relative pathing to HUGO_GO_ROOT_DIRECTORY
. Example:
layouts/partials/metas/meta.html
.