You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _learn/03-hugo-go-netlify.md
+14-7Lines changed: 14 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Since Hugo is built on Go, you can use the binary for your operating system. No
19
19
20
20
## Set up Hugo on Windows with Git Bash and Docker
21
21
22
-
You can also set up Docker and then use this [Docker image](https://hub.docker.com/r/jguyomard/hugo-builder/), and set up alias commands for `hugo` running in Docker, but using the same `hugo` commands in Git Bash on Windows.
22
+
You can also set up Docker and then use this [Docker image](https://hub.docker.com/r/jguyomard/hugo-builder/) to install Hugo. With the Docker image, you set up alias commands for `hugo` running in Docker, but can work in Git Bash and follow this tutorial using the same `hugo` commands in Git Bash on Windows.
23
23
24
24
## Set up Hugo on MacOS
25
25
1. Install Homebrew. See the [Homebrew site](https://brew.sh) for instructions.
@@ -33,7 +33,7 @@ You can also set up Docker and then use this [Docker image](https://hub.docker.c
33
33
34
34
```
35
35
$ hugo version
36
-
Hugo Static Site Generator v0.42.1 darwin/amd64
36
+
Hugo Static Site Generator v0.74.3/extended darwin/amd64 BuildDate: unknown
37
37
```
38
38
39
39
## Starting a Hugo site
@@ -42,6 +42,7 @@ For a Hugo static site, you can choose your specific theme after you create the
42
42
43
43
```
44
44
$ hugo new site docs-as-code
45
+
$ cd docs-as-code
45
46
```
46
47
47
48
1. Take a look at the files created in the directory with an `ls` command:
@@ -50,17 +51,23 @@ For a Hugo static site, you can choose your specific theme after you create the
50
51
archetypes content layouts themes
51
52
config.toml data static
52
53
```
54
+
55
+
1. Initialize the current directory as a Git repository, which will enable you to bring the theme in as a Git submodule.
56
+
```
57
+
$ git init
58
+
Initialized empty Git repository in /Users/annegentle/src/src/hugo-example/.git/
59
+
```
60
+
53
61
1. Edit `config.toml` in any text editor you like to get started. Choose a title for your site and the theme, in our case, `hugo-theme-learn`. The theme name in your configuration file must match the name of the specific theme directory inside the `/themes` directory, so we will add those files in the next step.
54
62
```
55
63
baseURL = "http://example.org/"
56
64
languageCode = "en-us"
57
65
title = "Learning Hugo Site"
58
66
theme = "hugo-theme-learn"
59
67
```
60
-
1. To get the theme files in the `/themes` directory, change to the themes directory, and then use a `git clone` command to get the required theme files.
68
+
1. To get the theme files in the `/themes` directory, and keep them updated, use a `git submodules` command to get the required theme files as well as keep them updated.
1. For Hugo, the `content` folder contains the site source content. For your home page, make an `_index.md` document in the `content` folder and write it with Markdown content. Switch back up one level since you just cloned the theme files.
66
73
```
@@ -87,7 +94,7 @@ Once you've prepared your local system, you can build locally and review the sit
87
94
88
95
For Hugo, it's important to know that draft pages are only served when using the `-D` parameter.
89
96
90
-
1. Run the `hugo server` command with the `-D` parameter.
97
+
1. Run the `hugo server` command with the `-D` parameter (to serve draft pages).
91
98
92
99
```
93
100
$ hugo server -D
@@ -111,7 +118,7 @@ For Hugo, it's important to know that draft pages are only served when using the
111
118
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
112
119
Press Ctrl+C to stop
113
120
```
114
-
1. Open the **Web Server** URL, `http://localhost:1313/` in your local browser to view the site.
121
+
2. Open the **Web Server** URL, `http://localhost:1313/` in your local browser to view the site. (By default, the theme may be purple instead of green.)
115
122

116
123
3. Press `Ctrl+C` in the server terminal to stop the Hugo server.
117
124
4. You can add your files to a Git commit. Refer to [Working with content in GitHub repositories](https://docslikecode.com/learn/04-add-content-workflow/) for a documentation workflow with your Hugo site.
0 commit comments