mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-13 07:55:52 -05:00
07b8d9466d
fb551cc75 Update index.md 7af894857 Update index.md d235753ea Hugo 0.82.1 e03e72deb Merge branch 'temp0821' e62648961 Merge branch 'release-0.82.1' e1ab0f6eb releaser: Add release notes to /docs for release of 0.82.1 5d354c38d Replaced ``` code blocks with Code Toggler c9d065c20 Remove duplicate YAML keys (#1420) 8ae31e701 Add webp image encoding support 848f2af26 Update internal.md (#1407) c103a86a4 Fix `ref` shortcode example output (#1409) 9f8ba56dc Remove leading dot from where function KEY (#1419) 363251a51 Improve presentation of template lookup order (#1382) b73da986d Improve description of Page Resources (#1381) 4e0bb96d5 Rework robots.txt page (#1405) edf893e6f Update migrations.md (#1412) 450f1580b Add link to `site` function doc (#1417) cfffa6e6f Added one extension to the list (#1414) 05f1665a0 Update theme 5de0b1c6a Update theme 250e20552 Add hugo.IsExtended dea5e1fd7 Fix typo on merge function page (#1408) 1bbed2cf3 Update configuration.md be0b64a46 Omit ISO cbb5b8367 Fix `dateFormat` documentation 698f15466 Regenerate the docshelper f9a8a7cb6 Update multilingual.md a22dc6267 Fix grammar (#1398) eb98b0997 Fix pretty URL example (#1397) f4c4153dc Mention date var complementation in post scheduling (#1396) 17fae284c Fix resources.ExecuteAsTemplate argument order (#1394) 97e2c2abb Use code-toggle shortcode in `multilingual.md` (#1388) 3a84929bb Harmonize capitalization (#1393) 17f15daa6 fix file naming used in example (#1392) 5d97b6a18 Add slice syntax to sections permalinks config 00665b97b Improve description of `site.md` edcf5e3fc Fix example in `merge.md` f275ab778 Update postprocess.md 9593e3991 Fix file name 59bd9656f Update postprocess.md 1172fb6d0 Update to theNewDynamic repository (#1263) f5b5c1d2c Update Hugo container image 4f2e92f2a Adapt anchorize.md to Goldmark 98aa19073 Directly link to `highlight` shortcode (#1384) 4c75c2422 Fix header level f15c06f23 markdownify: add note about render-hooks and .RenderString (#1281) 69c82eb68 Remove Blackfriday reference from shortcode desc (#1380) 36de478df Update description of ignoreFiles config setting (#1377) 6337699d8 Remove "Authors" page from documentation (#1371) 35e73ca90 fix indent in example (#1372) d3f01f19a Remove opening body tag from header example (#1376) 341a5a7d8 Update index.md c9bfdbee6 Release 0.82.0 119644949 releaser: Add release notes to /docs for release of 0.82.0 32efaed78 docs: Regenerate docs helper dea5449a2 docs: Regen CLI docs eeab18fce Merge commit '81689af79901f0cdaff765cda6322dd4a9a7ccb3' d508a1259 Attributes for code fences should be placed after the lang indicator only c80905cef deps: Update to esbuild v0.9.0 95350eb79 Add support for Google Analytics v4 02d36f9bc Allow markdown attribute lists to be used in title render hooks 7df220a64 Merge commit '9d31f650da964a52f05fc27b7fb99cf3e09778cf' d80bf61b7 Fixes #7698. git-subtree-dir: docs git-subtree-split: fb551cc750faa83a1493b0e0d0898cd98ab74465
179 lines
5.4 KiB
Markdown
179 lines
5.4 KiB
Markdown
---
|
|
title: Quick Start
|
|
linktitle: Quick Start
|
|
description: Create a Hugo site using the beautiful Ananke theme.
|
|
date: 2013-07-01
|
|
publishdate: 2013-07-01
|
|
categories: [getting started]
|
|
keywords: [quick start,usage]
|
|
authors: [Shekhar Gulati, Ryan Watters]
|
|
menu:
|
|
docs:
|
|
parent: "getting-started"
|
|
weight: 10
|
|
weight: 10
|
|
sections_weight: 10
|
|
draft: false
|
|
aliases: [/quickstart/,/overview/quickstart/]
|
|
toc: true
|
|
---
|
|
|
|
{{% note %}}
|
|
This quick start uses `macOS` in the examples. For instructions about how to install Hugo on other operating systems, see [install](/getting-started/installing).
|
|
|
|
It is recommended to have [Git installed](https://git-scm.com/downloads) to run this tutorial.
|
|
|
|
For other approaches learning Hugo like book or a video tutorial refer to the [external learning resources](/getting-started/external-learning-resources/) page.
|
|
{{% /note %}}
|
|
|
|
## Step 1: Install Hugo
|
|
|
|
{{% note %}}
|
|
`Homebrew` and `MacPorts`, package managers for `macOS`, can be installed from [brew.sh](https://brew.sh/) or [macports.org](https://www.macports.org/) respectively. See [install](/getting-started/installing) if you are running Windows etc.
|
|
{{% /note %}}
|
|
|
|
```bash
|
|
brew install hugo
|
|
# or
|
|
port install hugo
|
|
```
|
|
|
|
To verify your new install:
|
|
|
|
```bash
|
|
hugo version
|
|
```
|
|
|
|
{{< asciicast ItACREbFgvJ0HjnSNeTknxWy9 >}}
|
|
|
|
## Step 2: Create a New Site
|
|
|
|
```bash
|
|
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](https://themes.gohugo.io/) for a list of themes to consider. This quickstart uses the beautiful [Ananke theme](https://themes.gohugo.io/gohugo-theme-ananke/).
|
|
|
|
First, download the theme from GitHub and add it to your site's `themes` directory:
|
|
|
|
```bash
|
|
cd quickstart
|
|
git init
|
|
git submodule add https://github.com/theNewDynamic/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/theNewDynamic/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:
|
|
|
|
```bash
|
|
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:
|
|
|
|
```markdown
|
|
---
|
|
title: "My First Post"
|
|
date: 2019-03-26T08:47:11+01:00
|
|
draft: true
|
|
---
|
|
|
|
```
|
|
|
|
{{% note %}}
|
|
Drafts do not get deployed; once you finish a post, update the header of the post to say `draft: false`. More info [here](/getting-started/usage/#draft-future-and-expired-content).
|
|
{{% /note %}}
|
|
|
|
## Step 5: Start the Hugo server
|
|
|
|
Now, start the Hugo server with [drafts](/getting-started/usage/#draft-future-and-expired-content) 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/](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](https://kb.iu.edu/d/ahic).
|
|
{{% /note %}}
|
|
|
|
For theme specific configuration options, see the [theme site](https://github.com/theNewDynamic/gohugo-theme-ananke).
|
|
|
|
**For further theme customization, see [Customize a Theme](/themes/customizing/).**
|
|
|
|
### 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).
|
|
|