hugo/content/en/getting-started/quick-start.md
Bjørn Erik Pedersen 7125ad401a Squashed 'docs/' changes from 4dd2d6415..3b1a8579d
3b1a8579d Update theme
b1f04fd47 params: Adjust the twitter handle
2c8ba029f Fix typo
4421e46ec Update Where.md
5f9fec6a5 Update glossary.md
fb16945cf collections.Where - Clarify description of "collection"
4d6d7018b Update Include.md - improve return statement example
037151073 Update IncludeCached - improve return statement example
b053fa09c Improve return types
f7d615267 Describe minimum required Windows version
e97762b2a Update front matter in math.Sub
9e4d03a79 Fix data.GetJSON examples
9029ee123 Update spellcheck GitHub Action
c852fe421 Add version verification step to quick start guide
8fafca49c Correct front matter example
b412fdf65 Fix closing tag in notes docs
9a64d9579 Add hreflang Tag to Translation Link example
2d2a82101 Fix inverted examples in Permalink and RelPermalink
ff3e67e3f Correct spelling
3904b72e3 Fix documentation contribution steps enumeration
348fd3c02 Fix some typos in the content summaries page
a5823459a Fix two links, one to bonsai.io and one to digital.gov
c36978686 Fix typo
0ee3ff44f Vendor theme
6b0a9b75d Fix typo
44e4cb5c6 Fix typos
815071742 Update min Go version to build from source
192d14df5 Fix typo
e4a18946e Miscellaneous corrections
f12b7b74e netlify: Hugo 0.121.2
97dbc1ea1 Merge branch 'tempv0.121.2'
dc1c0aeeb Add cache note to resources.Concat
a8d1a6020 Correct return type
eca22e97c Fix front matter
7de247a03 Correct return type
5058bc520 collections.Seq: Specify max slice size
e24d81a4b Fix typo on FAQ page
ff8cf5a88 Correct 'related' front matter values
88b21fae0 Adjust deprecation handling
f7e19a25b Update terminology on shortcode templates page
01e10942a Adjust formatting
6ed2e19c2 tpl/math: Add math.Rand template function
b494a8d8d Update js.md
6d78035f4 Add interval description to glossary (#2378)
f9b612b64 Templates Lookup Order: Add missing parenthesis
741ab1bb2 Show vendorClosest in module default config
eb8cb878f Fix Babel headings
cdcdfc8e8 Change project name in Codeowners example
f31fe0d63 Update link to image filters
9dee1ee0e Update Solus installation instructions
716636fee Add TOC to collections.Sort
f7c64143c Update collections.Sort
4b8f6b991 Add id attributes to Scratch and Store methods
2a1adea79 Add id attributes to GitInfo, File, and Resources methods
b12d9cb8f Add Alpine Linux installation instructions
dfbebeec7 Change writeStats to buildStats
175b8aac8 resources/images: Create AutoOrient image filter
ba8e05c31 Update img shortcode
7fc15a6cc Fix default value of  pluralizeListTitles
a0be4fd8a Add Comentario to available comment engines
71aa7d8ab Update GitInfo.md
348441491 EXIF: describe applicable image types
743497eda Disable TOC for lang.Translate
b3b1df75d Describe lang.Translate fallback behavior
a6d9c362c Categorize CLI commands to improve search results
08cc2da4b Document canonical config for enabling inline shortcodes
8945be9c6 Update description of the humanize ordinal conversion
b8b4ccb6f Fix grammatical error
f53f9f936 Fix description of strings.HasSuffix
cdbe19b5b Update Params.md
e00c4eea2 Reformat site config descriptions
6f50c0755 Enumerate root configuration keys
1f2e7b9b2 Use canonical key when documenting menu configs
7d5a13d8d Update images.Text filter
315d2f8c3 Add math.Counter example to warnf
8ed9cdaa9 Miscellaneous edits
2bda491eb Fix front matter example
5c5bbbe3a netlify: Bump to Hugo 0.121.1
ed08f5943 Update Gentoo installation instructions
e4eb48457 Miscellaneous edits
8c3700d12 netlify: Bump to Hugo 0.121.0
1bb5a377f Merge branch 'tempv0.121.0'
8cba89504 Improve where function
0dfc00b0f docs: Regen docshelper
028076a66 Fix link to Gentoo package
52d2db4ff Fix typo
120025c19 Improve Gentooo installation instructions
0c31a4b45 Update GitHub hosting workflow example
dee99c36a Defend against missing aliases in quick-reference shortcode
d305278f1 Add Gentoo installation instructions
be98a37e1 docs: Adjust last merge from docs repository
a703dab53 docs: Regen docs helper
2e9c3532f Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'
f57fdb44b deps: Update github.com/tdewolff/minify/v2 v2.20.7 => v2.20.8
50cad5e38 tpl/transform: Add transform.XMLEscape template function

git-subtree-dir: docs
git-subtree-split: 3b1a8579d2e032c1aab8a74d4cf63849ba11e7a8
2024-01-26 08:11:52 +01:00

6.8 KiB
Raw Blame History

title description categories keywords menu weight toc aliases minVersion
Quick start Learn to create a Hugo site in minutes.
getting started
quick start
usage
docs
parent weight
getting-started 20
20 true
/quickstart/
/overview/quickstart/
v0.112.0

In this tutorial you will:

  1. Create a site
  2. Add content
  3. Configure the site
  4. Publish the site

Prerequisites

Before you begin this tutorial you must:

  1. Install Hugo (extended edition, {{% param "minVersion" %}} or later)
  2. Install Git

You must also be comfortable working from the command line.

Create a site

Commands

{{% note %}} If you are a Windows user:

  • Do not use the Command Prompt
  • Do not use Windows PowerShell
  • Run these commands from PowerShell or a Linux terminal such as WSL or Git Bash

PowerShell and Windows PowerShell are different applications.

{{% /note %}}

Verify that you have installed Hugo {{% param "minVersion" %}} or later.

hugo version

Run these commands to create a Hugo site with the Ananke theme. The next section provides an explanation of each command.

hugo new site quickstart
cd quickstart
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
echo "theme = 'ananke'" >> hugo.toml
hugo server

View your site at the URL displayed in your terminal. Press Ctrl + C to stop Hugo's development server.

Explanation of commands

Create the directory structure for your project in the quickstart directory.

hugo new site quickstart

Change the current directory to the root of your project.

cd quickstart

Initialize an empty Git repository in the current directory.

git init

Clone the Ananke theme into the themes directory, adding it to your project as a Git submodule.

git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke

Append a line to the site configuration file, indicating the current theme.

echo "theme = 'ananke'" >> hugo.toml

Start Hugo's development server to view the site.

hugo server

Press Ctrl + C to stop Hugo's development server.

Add content

Add a new page to your site.

hugo new content posts/my-first-post.md

Hugo created the file in the content/posts directory. Open the file with your editor.

+++
title = 'My First Post'
date = 2024-01-14T07:07:07+01:00
draft = true
+++

Notice the draft value in the front matter is true. By default, Hugo does not publish draft content when you build the site. Learn more about draft, future, and expired content.

Add some markdown to the body of the post, but do not change the draft value.

+++
title = 'My First Post'
date = 2024-01-14T07:07:07+01:00
draft = true
+++
## Introduction

This is **bold** text, and this is *emphasized* text.

Visit the [Hugo](https://gohugo.io) website!

Save the file, then start Hugos development server to view the site. You can run either of the following commands to include draft content.

hugo server --buildDrafts
hugo server -D

View your site at the URL displayed in your terminal. Keep the development server running as you continue to add and change content.

{{% note %}} Hugo's rendering engine conforms to the CommonMark specification for markdown. The CommonMark organization provides a useful live testing tool powered by the reference implementation.

{{% /note %}}

Configure the site

With your editor, open the site configuration file (hugo.toml) in the root of your project.

baseURL = 'https://example.org/'
languageCode = 'en-us'
title = 'My New Hugo Site'
theme = 'ananke'

Make the following changes:

  1. Set the baseURL for your production site. This value must begin with the protocol and end with a slash, as shown above.

  2. Set the languageCode to your language and region.

  3. Set the title for your production site.

Start Hugo's development server to see your changes, remembering to include draft content.

hugo server -D

{{% note %}} Most theme authors provide configuration guidelines and options. Make sure to visit your theme's repository or documentation site for details.

The New Dynamic, authors of the Ananke theme, provide documentation for configuration and usage. They also provide a demonstration site.

{{% /note %}}

Publish the site

In this step you will publish your site, but you will not deploy it.

When you publish your site, Hugo creates the entire static site in the public directory in the root of your project. This includes the HTML files, and assets such as images, CSS files, and JavaScript files.

When you publish your site, you typically do not want to include draft, future, or expired content. The command is simple.

hugo

To learn how to deploy your site, see the hosting and deployment section.

Ask for help

Hugo's forum is an active community of users and developers who answer questions, share knowledge, and provide examples. A quick search of over 20,000 topics will often answer your question. Please be sure to read about requesting help before asking your first question.

Other resources

For other resources to help you learn Hugo, including books and video tutorials, see the external learning resources page.