cfd74b57d Add a config file update step. 5957d8815 Wrap cache configuration in code-toggle 914405c0e capitalization and indentation fix for taxonomies page (#1159) 223b80f42 Fix page kinds shortcode not rendering on Taxonomies page (#1158) a9b6fa984 Clarify weight description. 29e121681 Warn about zero weights in front matter. 27ce7ba8c Release 0.73.0 e9596b2ee Merge branch 'temp73' 074a270cd releaser: Add release notes to /docs for release of 0.73.0 4f56a9fc0 width fix of expanding code box in documentation (#1156) f27254d60 css fix of expanding code box in documentation (#1155) 43b576178 Fix incorrect directory name in quick-start (#1154) 16726eacf Add GroupByLastmod 73c31758e Fix for broken link again (#1151) d07067295 Fix broken link (#1144) bc0b484d1 Rename taxonomy kinds from taxonomy to term, taxonomyTerm to taxonomy 674d71842 Fix Typo on Docker section of installation page b87778165 Merge commit 'efa74c5c6e6ff1daddeb5834ea7c69bed2acf171' c7cdebed3 tpl/crypto: Add hmac 260130cc0 Allow hook template per section/type 1f70519d8 releaser: Add release notes to /docs for release of 0.72.0 8516d540c Merge commit '9e1dcefc5f559944b70d2fa520f6acd5c56a69f2' c49195c69 common/maps: Add Scratch.Values 78072df81 Add redirect support to the server 90ca0af6b Fix typo in install instructions git-subtree-dir: docs git-subtree-split: cfd74b57d968d98f88d3ddaee651d9cbe79b7ce1
5.2 KiB
title | linktitle | description | date | publishdate | categories | keywords | authors | menu | weight | sections_weight | draft | aliases | toc | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Quick Start | Quick Start | Create a Hugo site using the beautiful Ananke theme. | 2013-07-01 | 2013-07-01 |
|
|
|
|
10 | 10 | false |
|
true |
{{% note %}}
This quick start uses macOS
in the examples. For instructions about how to install Hugo on other operating systems, see install.
It is recommended to have Git installed to run this tutorial.
For other approaches learning Hugo like book or a video tutorial refer to the external learning resources page. {{% /note %}}
Step 1: Install Hugo
{{% note %}}
Homebrew
, a package manager for macOS
, can be installed from brew.sh. See install if you are running Windows etc.
{{% /note %}}
brew install hugo
To verify your new install:
hugo version
{{< asciicast ItACREbFgvJ0HjnSNeTknxWy9 >}}
Step 2: Create a New Site
hugo new site quickstart
The above will create a new Hugo site in a folder named quickstart
.
{{< asciicast 3mf1JGaN0AX0Z7j5kLGl3hSh8 >}}
Step 3: Add a Theme
See themes.gohugo.io for a list of themes to consider. This quickstart uses the beautiful Ananke theme.
First, download the theme from GitHub and add it to your site's themes
directory:
cd quickstart
git init
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
Note for non-git users:
- If you do not have git installed, you can download the archive of the latest version of this theme from: https://github.com/budparr/gohugo-theme-ananke/archive/master.zip
- Extract that .zip file to get a "gohugo-theme-ananke-master" directory.
- Rename that directory to "ananke", and move it into the "themes/" directory.
Then, add the theme to the site configuration:
echo 'theme = "ananke"' >> config.toml
{{< asciicast 7naKerRYUGVPj8kiDmdh5k5h9 >}}
Step 4: Add Some Content
You can manually create content files (for example as content/<CATEGORY>/<FILE>.<FORMAT>
) and provide metadata in them, however you can use the new
command to do a few things for you (like add title and date):
hugo new posts/my-first-post.md
{{< asciicast eUojYCfRTZvkEiqc52fUsJRBR >}}
Edit the newly created content file if you want, it will start with something like this:
---
title: "My First Post"
date: 2019-03-26T08:47:11+01:00
draft: true
---
Step 5: Start the Hugo server
Now, start the Hugo server with drafts enabled:
{{< asciicast BvJBsF6egk9c163bMsObhuNXj >}}
▶ hugo server -D
| EN
+------------------+----+
Pages | 10
Paginator pages | 0
Non-page files | 0
Static files | 3
Processed images | 0
Aliases | 1
Sitemaps | 1
Cleaned | 0
Total in 11 ms
Watching for changes in /Users/bep/quickstart/{content,data,layouts,static,themes}
Watching for config changes in /Users/bep/quickstart/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
Navigate to your new site at http://localhost:1313/.
Feel free to edit or add new content and simply refresh in browser to see changes quickly (You might need to force refresh in webbrowser, something like Ctrl-R usually works).
Step 6: Customize the Theme
Your new site already looks great, but you will want to tweak it a little before you release it to the public.
Site Configuration
Open up config.toml
in a text editor:
baseURL = "https://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
theme = "ananke"
Replace the title
above with something more personal. Also, if you already have a domain ready, set the baseURL
. Note that this value is not needed when running the local development server.
{{% note %}} Tip: Make the changes to the site configuration or any other file in your site while the Hugo server is running, and you will see the changes in the browser right away, though you may need to clear your cache. {{% /note %}}
For theme specific configuration options, see the theme site.
For further theme customization, see Customize a Theme.
Step 7: Build static pages
It is simple. Just call:
hugo -D
Output will be in ./public/
directory by default (-d
/--destination
flag to change it, or set publishdir
in the config file).
{{% note %}}
Drafts do not get deployed; once you finish a post, update the header of the post to say draft: false
. More info here.
{{% /note %}}