mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
3902f9a476
7030fe3a2 Remove .hvm file dd0f98831 Add details for DigitalOcean (#1730) ff0c8a6e7 netlify: Hugo 0.97.3 e254724a7 Delete hosting-on-bitbucket.md (#1723) f4304fb7e Remove references to mmark (#1727) 255319023 remove broken link to codeplex.com (#1725) 06cc3856b delete broken link (#1724) ec80dc069 Revert "netlify: Hugo 0.97.2" 211bad5de netlify: Hugo 0.97.2 cd549bca9 Revert "netlify: Update to Hugo 0.97.1" (#1722) 1039a0a48 netlify: Update to Hugo 0.97.1 a28e0d0d3 Update AddDate method 9077b443f Update lists.md 6b174329a Update lists.md d87d9e296 netlify: Hugo 0.97.0 fa7db7c7e Merge branch 'tempv0.97.0' dd6df54b5 Fix broken anchor links (#1717) 6b6743976 Remove StackImpact showcase d00a7eda9 Fix for Cloudflare docs location (#1716) 890866722 Add git required FAQ & remove ZIP from Quick Start (#1713) 73e82d911 resources: Add `key` to reources.GetRemote options map 6795cd2a1 Correct possible typos re: Alias robots usage (#1165) efd5d186a Hosting on Cloudflare Pages (#1709) 9239c5f2a deps: Update github.com/tdewolff/minify/v2 v2.10.0 => v2.11.0 859573bc8 Merge commit 'ec920363cdeb687c8bcac9c242767d366fb058cb' 21f108f12 docs: Regen CLI docs 9b6e7afd2 Add environment as a new filter to _cascade.target git-subtree-dir: docs git-subtree-split: 7030fe3a2ea107a23a4442902cb693557a421523
172 lines
5 KiB
Markdown
172 lines
5 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 required to have [Git installed](https://git-scm.com/downloads) to run this tutorial.
|
|
|
|
For other approaches to learning Hugo (like books or video tutorials), 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
|
|
```
|
|
|
|
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 your web browser, 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).
|
|
|