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
+34-21Lines changed: 34 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,12 +33,12 @@ 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.74.3/extended darwin/amd64 BuildDate: unknown
36
+
hugo v0.135.0+extended darwin/amd64 BuildDate=2024-09-27T13:17:08Z VendorInfo=brew
37
37
```
38
38
39
39
## Starting a Hugo site
40
40
41
-
For a Hugo static site, you can choose your specific theme after you create the source files. The theme we'll use in this tutorial is [hugo-theme-learn](https://themes.gohugo.io/hugo-theme-learn/). To start a new site in the current folder, run:
41
+
For a Hugo static site, you can choose your specific theme after you create the source files. The theme we'll use in this tutorial is [hugo-theme-relearn](https://themes.gohugo.io/themes/hugo-theme-relearn/). To start a new site in the current folder, run:
42
42
43
43
```
44
44
$ hugo new site docs-as-code
@@ -48,56 +48,69 @@ For a Hugo static site, you can choose your specific theme after you create the
48
48
1. Take a look at the files created in the directory with an `ls` command:
49
49
```
50
50
$ ls -A
51
-
archetypes content layouts themes
52
-
config.toml data static
51
+
archetypes content hugo.toml layouts themes
52
+
assets data i18n static
53
53
```
54
54
55
55
1. Initialize the current directory as a Git repository, which will enable you to bring the theme in as a Git submodule.
56
56
```
57
57
$ git init
58
-
Initialized empty Git repository in /Users/annegentle/src/src/hugo-example/.git/
58
+
Initialized empty Git repository in /Users/agentle/src/hugo-example/.git/
59
59
```
60
60
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.
61
+
1. Edit `hugo.toml` in any text editor you like to get started. Choose a title for your site and the theme, in our case, `hugo-theme-relearn`. (Find the [installation documentation for the Relearn Theme here](https://mcshelby.github.io/hugo-theme-relearn/basics/installation/index.html).) 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.
62
62
```
63
63
baseURL = "http://example.org/"
64
64
languageCode = "en-us"
65
65
title = "Learning Hugo Site"
66
-
theme = "hugo-theme-learn"
66
+
[module]
67
+
[[module.imports]]
68
+
path = 'github.com/McShelby/hugo-theme-relearn'
67
69
```
68
70
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.
73
85
```
74
86
$ cd ..
75
-
$ hugo new _index.md
87
+
$ hugo new --kind home _index.md
88
+
Content "/Users/agentle/src/hugo-example/hugo-example/content/_index.md" created
76
89
```
77
-
1. Next, add a new page using the `hugo` command, `hugo new`:
90
+
1. Next, add a new chapter page using the `hugo` command, `hugo new`:
78
91
```
79
-
$ hugo new prerequisites.md
80
-
/Users/agentle/src/hugo-example/doc-machine/content/prerequisites.md created
92
+
$ hugo new --kind chapter get-started/_index.md
93
+
/Users/agentle/src/hugo-example/content/get-started/_index.md created
81
94
```
82
-
1. You can keep adding files with the `hugo new` command so that the Markdown files are pre-populated with the front matter:
95
+
1. You can keep adding files with the `hugo new` command so that the Markdown files are pre-populated with the front matter such as:
83
96
```
84
-
---
85
-
title: "Prerequisites"
86
-
date: 2018-06-16T10:38:19-05:00
87
-
draft: true
88
-
---
97
+
+++
98
+
archetype = "chapter"
99
+
title = "Get Started"
100
+
weight = 1
101
+
+++
89
102
```
90
103
91
104
## Build a Hugo site locally
92
105
93
106
Once you've prepared your local system, you can build locally and review the site in your browser.
94
107
95
-
For Hugo, it's important to know that draft pages are only served when using the `-D` parameter.
108
+
For Hugo, it's important to know that draft pages, where `draft = true` is in the front matter, won't be served.
96
109
97
-
1. Run the `hugo server`command with the `-D` parameter (to serve draft pages).
110
+
1. Run the `hugo server`(or `hugo serve`) command to run a local server with your draft website.
0 commit comments