+++ title = "Installing hugo on Linux" summary = """This is how I install hugo nowadays. Although that routine might change anytime.""" date = "2022-12-04T18:04:34+01:00" lastmod = "2022-12-04T23:29:01+01:00" categories = ["computerstuff"] tags = ["linux","gohugo"] draft = true [sitemap] priority = 1.0 +++ ## Build from source To build Hugo from source you must: - Install Git - Install Go version 1.18 or later - Update your PATH environment variable as described in the Go documentation The install directory is controlled by the GOPATH and GOBIN environment variables. If GOBIN is set, binaries are installed to that directory. If GOPATH is set, binaries are installed to the bin subdirectory of the first directory in the GOPATH list. Otherwise, binaries are installed to the bin subdirectory of the default GOPATH ($HOME/go or %USERPROFILE%\go). Then build and test: ~~~console $ go install -tags extended github.com/gohugoio/hugo@latest $ hugo version ~~~ ## Using hugo theme as module... ### Quick start using Hugo Note: Ensure you have Go and Hugo installed, and that you have created a new Hugo project before proceeding. From your project directory, initialise Hugo Modules: ~~~console $ hugo mod init github.com// ~~~ Create config/_default/module.toml and add the following: ~~~toml [[imports]] path = "github.com/jpanther/congo/v2" ~~~ Start your server using hugo server and the theme will be downloaded automatically. In the root folder of your website, delete the config.toml file that was generated by Hugo. Copy the *.toml config files from the theme into your config/_default/ folder. {{< alert >}} Note: Do not overwrite the module.toml file you created above! {{< /alert >}} You will find these theme config files in the Hugo cache directory, or download a copy from GitHub. Follow the Getting Started instructions to configure your website. ## use Atom feeds Define an appropriate media type and corresponding output format in config.toml: ```toml [mediaTypes] [mediaTypes."application/atom"] suffix = "xml" [outputFormats.Atom] mediaType = "application/atom" baseName = "index" isPlainText = false ``` Tell Hugo to produce the home page in Atom and HTML formats, also in config.toml: ```toml [outputs] home = [ "HTML", "Atom" ] ``` Put an index.atom.xml template file in your layouts directory. You can use the attached one as a starting point, don't forget to edit the author element appropriately or make it take the values from your config. ```xml {{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }} {{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }} YOUR NAME HERE YOUR EMAIL ADDRESS DEFINITIVE URI OF YOUR WEB SITE {{ .Permalink }} {{ range first 15 .Data.Pages }} {{ .Title }} {{ .Permalink }} {{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }} {{ .Lastmod.Format "2006-01-02T15:04:05-0700" | safeHTML }} {{ .Summary | html }} {{ end }} ``` source: