diff --git a/site/go.mod b/site/go.mod index b1614296c1..b7ac6b63a5 100644 --- a/site/go.mod +++ b/site/go.mod @@ -1,5 +1,5 @@ module github.com/nginx/agent/site -go 1.18 +go 1.22.0 -require github.com/nginxinc/nginx-hugo-theme v0.41.14 // indirect +require github.com/nginxinc/nginx-hugo-theme v0.41.19 // indirect diff --git a/site/go.sum b/site/go.sum index 1cbbb6618c..5dbffbf03f 100644 --- a/site/go.sum +++ b/site/go.sum @@ -1,2 +1,2 @@ -github.com/nginxinc/nginx-hugo-theme v0.41.14 h1:OraNB01CdMJXufPddvIVt6qn6Mj38Z/XCVIWBgVtuY0= -github.com/nginxinc/nginx-hugo-theme v0.41.14/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M= +github.com/nginxinc/nginx-hugo-theme v0.41.19 h1:CyZOhU8q0p3nQ+ZTFRx7c/Dq9rxV1mShADIHz0vDoHo= +github.com/nginxinc/nginx-hugo-theme v0.41.19/go.mod h1:DPNgSS5QYxkjH/BfH4uPDiTfODqWJ50NKZdorguom8M= diff --git a/site/hugo-entrypoint.sh b/site/hugo-entrypoint.sh new file mode 100755 index 0000000000..dc72123528 --- /dev/null +++ b/site/hugo-entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +hugo mod get -u github.com/nginxinc/nginx-hugo-theme +hugo $* diff --git a/site/makefile b/site/makefile new file mode 100644 index 0000000000..bb62ce8b67 --- /dev/null +++ b/site/makefile @@ -0,0 +1,64 @@ +HUGO?=hugo +HUGO_VERSION?=$(shell hugo version 2>/dev/null | awk '{print $$2}' | cut -d '.' -f 2) +HUGO_IMG?=hugomods/hugo:std-go-git-0.134.3 + +THEME_MODULE = github.com/nginxinc/nginx-hugo-theme + +ifeq ($(shell [ $(HUGO_VERSION) -gt 133 2>/dev/null ] && echo true || echo false), true) + $(info Hugo is available and has a version greater than 133. Proceeding with build.) +else + $(warning Hugo is not available or using a version less than 134. Attempting to use docker. HUGO_VERSION=$(HUGO_VERSION)) + HUGO=docker run --rm -it -v ${CURDIR}:/src -p 1313:1313 ${HUGO_IMG} /src/hugo-entrypoint.sh + ifeq (, $(shell docker version 2> /dev/null)) + $(error Hugo (>0.134) or Docker are required to build the local previews.) + endif +endif + +MARKDOWNLINT?=markdownlint +MARKDOWNLINT_IMG?=ghcr.io/igorshubovych/markdownlint-cli:latest + +ifeq (, $(shell ${MARKDOWNLINT} version 2> /dev/null)) +ifeq (, $(shell docker version 2> /dev/null)) +else + MARKDOWNLINT=docker run --rm -i -v ${CURDIR}:/src --workdir /src ${MARKDOWNLINT_IMG} +endif +endif + +MARKDOWNLINKCHECK?=markdown-link-check +MARKDOWNLINKCHECK_IMG?=ghcr.io/tcort/markdown-link-check:stable + +ifeq (, $(shell ${MARKDOWNLINKCHECK} --version 2> /dev/null)) +ifeq (, $(shell docker version 2> /dev/null)) +else + MARKDOWNLINKCHECK=docker run --rm -it -v ${CURDIR}:/docs --workdir /docs ${MARKDOWNLINKCHECK_IMG} +endif +endif + + +.PHONY: docs docs-draft docs-local clean hugo-get hugo-tidy lint-markdown link-check + +docs: + ${HUGO} + +watch: + ${HUGO} --bind 0.0.0.0 -p 1313 server --disableFastRender + +drafts: + ${HUGO} --bind 0.0.0.0 -p 1313 server -D --disableFastRender + +clean: + [ -d "public" ] && rm -rf "public" + +hugo-get: + hugo mod get -u github.com/nginxinc/nginx-hugo-theme + +hugo-tidy: + hugo mod tidy + +hugo-update: hugo-get hugo-tidy + +lint-markdown: + ${MARKDOWNLINT} -c .markdownlint.yaml -- content + +link-check: + ${MARKDOWNLINKCHECK} $(shell find content -name '*.md')