Skip to content

Commit

Permalink
docs: fix format of the netlify makefile example (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys committed Feb 11, 2024
1 parent 3bbcde0 commit 833d108
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ MD041: False
MD042: False
MD004:
style: dash
MD010:
code_blocks: False
29 changes: 18 additions & 11 deletions exampleSite/content/posts/usage/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ curl -L https://github.com/thegeeklab/hugo-geekblog/releases/latest/download/hug
### Option 2: Clone the GitHub repository

{{< hint type=note >}}
**Info**\
Keep in mind this method is not recommended and needs some extra steps to get it working.
If you want to use the Theme as submodule keep in mind that your build process need to
run the described steps as well.
Expand All @@ -169,39 +168,48 @@ There are several ways to deploy your site with this theme on Netlify. Regardles

Here are some possible solutions:

**Use a Makefile:**
#### Use a Makefile

Add a Makefile to your repository to bundle the required steps.

{{< hint type=important >}}
The `Makefile` is only an example. Depending on your project structure, `BASEDIR` or `THEMEDIR` may need to be adapted.
{{< /hint >}}

```makefile
THEME_VERSION := v0.8.2
# Please change the theme version to the latest release version.
THEME_VERSION := v0.26.1
THEME := hugo-geekblog
BASEDIR := docs
THEMEDIR := $(BASEDIR)/themes

.PHONY: doc
doc: doc-assets doc-build

.PHONY: doc-assets
doc-assets:
mkdir -p $(THEMEDIR)/$(THEME)/ ; \
curl -sSL "https://github.com/thegeeklab/$(THEME)/releases/download/${THEME_VERSION}/$(THEME).tar.gz" | tar -xz -C $(THEMEDIR)/$(THEME)/ --strip-components=1
mkdir -p $(THEMEDIR)/$(THEME)/ ; \
curl -sSL "https://github.com/thegeeklab/$(THEME)/releases/download/${THEME_VERSION}/$(THEME).tar.gz" | tar -xz -C $(THEMEDIR)/$(THEME)/ --strip-components=1

.PHONY: doc-build
doc-build:
cd $(BASEDIR); hugo
cd $(BASEDIR); hugo

.PHONY: clean
clean:
rm -rf $(THEMEDIR) && \
rm -rf $(BASEDIR)/public
rm -rf $(THEMEDIR) && \
rm -rf $(BASEDIR)/public
```

This Makefile can be used in your `netlify.toml`, take a look at the Netlify [example](https://docs.netlify.com/configure-builds/file-based-configuration/#sample-netlify-toml-file) for more information:
This Makefile can be used in your `netlify.toml`, take a look at the [Netlify example](https://docs.netlify.com/configure-builds/file-based-configuration/#sample-netlify-toml-file) for more information:

```toml
[build]
publish = "docs/public"
command = "make doc"
```

**Chain required commands:**
#### Chain required commands

Chain all required commands to prepare the theme and build your site on the `command` option in your `netlify.toml` like this:

Expand All @@ -214,7 +222,6 @@ command = "command1 && command 2 && command3 && hugo"
### Subdirectories

{{< hint type=important >}}
**Warning**\
As deploying Hugo sites on subdirectories is not as robust as on subdomains, we do not recommend this.
If you have a choice, using a domain/subdomain should always be the preferred solution!
{{< /hint >}}
Expand Down

0 comments on commit 833d108

Please sign in to comment.