Deploy a Hugo site.
Hugo is a tool for generating static sites, written in Go. It is incredibly fast and has great high-level, flexible primitives for managing your content using Markdown and JSON.
In this guide, you will create a new Hugo application and deploy it using Youappz Sitez. You will use the hugo
CLI to create a new Hugo site.
Installing Hugo
First, install the Hugo CLI, using the specific instructions for your operating system below:
Linux
Your Linux distro's package manager may include Hugo. If this is the case, install it directly using your distro's package manager -- for instance, in Ubuntu, run the following command:
$ sudo apt-get install hugo
If your package manager does not include Hugo or you would like to download a release directly, refer to the Manual section.
Homebrew (macOS)
If you use the package manager Homebrew, run the brew install
command in your terminal to install Hugo:
$ brew install hugo
Windows (Chocolatey)
If you use the package manager Chocolatey, run the choco install
command in your terminal to install Hugo:
$ choco install hugo --confirm
Windows (Scoop)
If you use the package manager Scoop, run the scoop install
command in your terminal to install Hugo:
$ scoop install hugo
Manual installation
The Hugo GitHub repository contains pre-built versions of the Hugo command-line tool for various operating systems, which can be found on the Releases page.
For more instruction on installing these releases, refer to Hugo's install guide.
Creating a new project
With Hugo installed, create a new project by running the hugo new
command in your terminal:
$ hugo new site my-hugo-site
Hugo sites use themes to customize the look and feel of the statically built HTML site. There are a number of themes available at themes.gohugo.io -- for now, use the Terminal theme by running the following commands in your terminal:
$ cd my-hugo-site
$ git init
$ git submodule add https://github.com/panr/hugo-theme-terminal.git themes/terminal
$ git submodule update --init --recursive
You should also copy the default configuration provided by the theme into the config.toml
file in your project's directory. Take the following information and customize it per your site's needs:
baseurl = "/"
languageCode = "en-us"
theme = "terminal"
paginate = 5 [params] # dir name of your main content (default is `content/posts`). # the list of set content will show up on your index page (baseurl). contentTypeName = "posts" # ["orange", "blue", "red", "green", "pink"] themeColor = "orange" # if you set this to 0, only submenu trigger will be visible showMenuItems = 2 # show selector to switch language showLanguageSelector = false # set theme to full screen width fullWidthTheme = false # center theme with default width centerTheme = false # set a custom favicon (default is a `themeColor` square) # favicon = "favicon.ico" # set post to show the last updated # If you use git, you can set `enableGitInfo` to `true` and then post will automatically get the last updated showLastUpdated = false # Provide a string as a prefix for the last update date. By default, it looks like this: 2020-xx-xx [Updated: 2020-xx-xx] :: Author # updatedDatePrefix = "Updated" # set all headings to their default size (depending on browser settings) # it's set to `true` by default # oneHeadingSize = false [params.twitter] # set Twitter handles for Twitter cards # see https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started#card-and-content-attribution # do not include @ creator = "" site = "" [languages] [languages.en] languageName = "English" title = "Terminal" subtitle = "A simple, retro theme for Hugo" owner = "" keywords = "" copyright = "" menuMore = "Show more" readMore = "Read more" readOtherPosts = "Read other posts" missingContentMessage = "Page not found..." missingBackButtonLabel = "Back to home page" [languages.en.params.logo] logoText = "Terminal" logoHomeLink = "/" [languages.en.menu] [[languages.en.menu.main]] identifier = "about" name = "About" url = "/about" [[languages.en.menu.main]] identifier = "showcase" name = "Showcase" url = "/showcase"
Creating a post
Create a new post to give your Hugo site some initial content. Run the hugo new
command in your terminal to generate a new post:
$ hugo new posts/hello-world.md
Inside of hello-world.md
, add some initial content to create your post. Remove the draft
line in your post's frontmatter when you are ready to publish the post. Any posts with draft: true
set will be skipped by Hugo's build process.
Deploying with Youappz Sitez
Deploy your site to Sitez by running the following commands
cd my-hugo-site
appz create -n my-hugo-site
appz deploy -d public
In less than 30 seconds your website will be deployed to an https URL on our global CDN.
For the complete guide to deploying your first site to Youappz Sitez, refer to the Get started guide.
After deploying your site, you will receive a unique subdomain for your project on *.sitez.live
.
Every time you deploy your Gatsby site, Youappz Sitez will automatically rebuild your project and deploy it. You will also get access to preview deployments on every deploy, so you can preview how changes look to your site before deploying them to production.
Using a specific Hugo version
You can set the environment variable HUGO_VERSION
under Settings to use a specific version of Hugo.
For example, HUGO_VERSION
: 0.81.0