11HUGO? =hugo
2- HUGO_IMG? =hugomods/hugo:0.134.1
2+ HUGO_VERSION? =$(shell hugo version 2>/dev/null | awk '{print $$2}' | cut -d '.' -f 2)
3+ HUGO_IMG? =hugomods/hugo:std-go-git-0.134.3
34
45THEME_MODULE = github.com/nginxinc/nginx-hugo-theme
5- THEME_VERSION ?= $(shell curl -s https://api.github.com/repos/nginxinc/nginx-hugo-theme/releases/latest | jq -r ".tag_name")
66
7- ifeq (, $(shell ${HUGO} version 2> /dev/null) )
8- ifeq (, $(shell docker version 2> /dev/null) )
9- $(error Docker and Hugo are not installed. Hugo (<0.91) or Docker are required to build the local preview.)
7+ HUGO_CI =docker run --rm -v ${CURDIR}:/src ${HUGO_IMG} hugo
8+
9+ ifeq ($(shell [ $(HUGO_VERSION ) -gt 133 2>/dev/null ] && echo true || echo false) , true)
10+ $(info Hugo is available and has a version greater than 133. Proceeding with build.)
1011else
11- HUGO =docker run --rm -it -v ${CURDIR}:/src -p 1313:1313 ${HUGO_IMG} hugo --bind 0.0.0.0 -p 1313
12+ $(warning Hugo is not available or using a version less than 134. Attempting to use docker. HUGO_VERSION=$(HUGO_VERSION))
13+ HUGO =docker run --rm -it -v ${CURDIR}:/src -p 1313:1313 ${HUGO_IMG} /src/hugo-entrypoint.sh
14+ ifeq (, $(shell docker version 2> /dev/null))
15+ $(error Hugo (>0.134) or Docker are required to build the local previews.)
16+ endif
1217endif
13- endif
14-
15- HUGO_CI =docker run --rm -v ${CURDIR}:/src ${HUGO_IMG} hugo
1618
1719MARKDOWNLINT? =markdownlint
1820MARKDOWNLINT_IMG? =ghcr.io/igorshubovych/markdownlint-cli:latest
1921
2022ifeq (, $(shell ${MARKDOWNLINT} version 2> /dev/null) )
2123ifeq (, $(shell docker version 2> /dev/null) )
22- $(error Docker and markdownlint are not installed. markdownlint or Docker are required to lint.)
23- endif
2424else
2525 MARKDOWNLINT =docker run --rm -i -v ${CURDIR}:/src --workdir /src ${MARKDOWNLINT_IMG}
2626endif
27+ endif
2728
2829MARKDOWNLINKCHECK? =markdown-link-check
2930MARKDOWNLINKCHECK_IMG? =ghcr.io/tcort/markdown-link-check:stable
3031
3132ifeq (, $(shell ${MARKDOWNLINKCHECK} --version 2> /dev/null) )
3233ifeq (, $(shell docker version 2> /dev/null) )
33- $(error Docker and markdown-link-check are not installed. markdown-link-check or Docker are required to check links.)
34- endif
3534else
36- MARKDOWNLINKCHECK =docker run --rm -it -v ${CURDIR}:/site --workdir /site ${MARKDOWNLINKCHECK_IMG}
35+ MARKDOWNLINKCHECK =docker run --rm -it -v ${CURDIR}:/docs --workdir /docs ${MARKDOWNLINKCHECK_IMG}
3736endif
37+ endif
38+
3839
3940.PHONY : docs docs-draft docs-local clean hugo-get hugo-tidy lint-markdown link-check
4041
@@ -51,11 +52,10 @@ drafts:
5152 ${HUGO} --bind 0.0.0.0 -p 1313 server -D --disableFastRender
5253
5354clean :
54- hugo mod clean
5555 [ -d " public" ] && rm -rf " public"
5656
5757hugo-get :
58- hugo mod get $( THEME_MODULE ) @ $( THEME_VERSION )
58+ hugo mod get -u github.com/nginxinc/nginx-hugo-theme
5959
6060hugo-tidy :
6161 hugo mod tidy
0 commit comments