Skip to content

Commit 6c05fe5

Browse files
authored
Merge pull request #157 from justwriteclick/ag-theme
Add a git init step and use submodule for theme
2 parents 4552dc8 + de525aa commit 6c05fe5

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

_learn/03-hugo-go-netlify.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Since Hugo is built on Go, you can use the binary for your operating system. No
1919

2020
## Set up Hugo on Windows with Git Bash and Docker
2121

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.
2323

2424
## Set up Hugo on MacOS
2525
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
3333

3434
```
3535
$ 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
3737
```
3838

3939
## Starting a Hugo site
@@ -42,6 +42,7 @@ For a Hugo static site, you can choose your specific theme after you create the
4242

4343
```
4444
$ hugo new site docs-as-code
45+
$ cd docs-as-code
4546
```
4647

4748
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
5051
archetypes content layouts themes
5152
config.toml data static
5253
```
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+
5361
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.
5462
```
5563
baseURL = "http://example.org/"
5664
languageCode = "en-us"
5765
title = "Learning Hugo Site"
5866
theme = "hugo-theme-learn"
5967
```
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.
6169
```
62-
$ cd themes
63-
$ git clone https://github.com/matcornic/hugo-theme-learn.git
70+
$ git submodule add https://github.com/matcornic/hugo-theme-learn.git themes/hugo-theme-learn
6471
```
6572
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.
6673
```
@@ -87,7 +94,7 @@ Once you've prepared your local system, you can build locally and review the sit
8794

8895
For Hugo, it's important to know that draft pages are only served when using the `-D` parameter.
8996

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).
9198

9299
```
93100
$ hugo server -D
@@ -111,7 +118,7 @@ For Hugo, it's important to know that draft pages are only served when using the
111118
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
112119
Press Ctrl+C to stop
113120
```
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.)
115122
![Example Hugo site](/images/learn/hugo-docs-page.png)
116123
3. Press `Ctrl+C` in the server terminal to stop the Hugo server.
117124
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

Comments
 (0)