Skip to content

Commit f1d8dc0

Browse files
authored
Update documentation Makefile and README (#6339)
This commit updates the documentation Makefile and README, reflecting changes to it across NGINX's open source repositories for consistency. It removes unnecessary targets: Netlify is no longer used, nor was the Makefile used for Netlify for quite some time. The guidance for Makefile targets in the README is updated accordingly, as well formatting instructions for how we use Hugo contemporaneously.
1 parent 6178324 commit f1d8dc0

File tree

2 files changed

+28
-55
lines changed

2 files changed

+28
-55
lines changed

docs/Makefile

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
HUGO?=hugo
2-
# the officially recommended unofficial docker image
32
HUGO_IMG?=hugomods/hugo:0.115.3
43

54
THEME_MODULE = github.com/nginxinc/nginx-hugo-theme
6-
## Pulls the current theme version from the Netlify settings
75
THEME_VERSION = 0.41.14
8-
NETLIFY_DEPLOY_URL = ${DEPLOY_PRIME_URL}
96

10-
# if there's no local hugo, fallback to docker
117
ifeq (, $(shell ${HUGO} version 2> /dev/null))
128
ifeq (, $(shell docker version 2> /dev/null))
139
$(error Docker and Hugo are not installed. Hugo (<0.91) or Docker are required to build the local preview.)
1410
else
15-
HUGO=docker run --rm -it -v ${CURDIR}:/src -p 1313:1313 ${HUGO_IMG} hugo
11+
HUGO=docker run --rm -it -v ${CURDIR}:/src -p 1313:1313 ${HUGO_IMG} hugo --bind 0.0.0.0 -p 1313
1612
endif
1713
endif
1814

1915
MARKDOWNLINT?=markdownlint
2016
MARKDOWNLINT_IMG?=ghcr.io/igorshubovych/markdownlint-cli:latest
2117

22-
# if there's no local markdownlint, fallback to docker
2318
ifeq (, $(shell ${MARKDOWNLINT} version 2> /dev/null))
2419
ifeq (, $(shell docker version 2> /dev/null))
25-
ifneq (, $(shell $(NETLIFY) "true"))
2620
$(error Docker and markdownlint are not installed. markdownlint or Docker are required to lint.)
2721
endif
2822
else
@@ -32,60 +26,40 @@ endif
3226

3327
MARKDOWNLINKCHECK?=markdown-link-check
3428
MARKDOWNLINKCHECK_IMG?=ghcr.io/tcort/markdown-link-check:stable
35-
# if there's no local markdown-link-check, fallback to docker
29+
3630
ifeq (, $(shell ${MARKDOWNLINKCHECK} --version 2> /dev/null))
3731
ifeq (, $(shell docker version 2> /dev/null))
38-
ifneq (, $(shell $(NETLIFY) "true"))
3932
$(error Docker and markdown-link-check are not installed. markdown-link-check or Docker are required to check links.)
4033
endif
4134
else
4235
MARKDOWNLINKCHECK=docker run --rm -it -v ${CURDIR}:/site --workdir /site ${MARKDOWNLINKCHECK_IMG}
4336
endif
4437
endif
4538

46-
.PHONY: all all-staging all-dev all-local clean hugo-mod build-production build-staging build-dev docs-drafts docs deploy-preview
47-
48-
all: hugo-mod build-production
49-
50-
all-staging: hugo-mod build-staging
51-
52-
all-dev: hugo-mod build-dev
53-
54-
all-local: clean hugo-mod build-production
39+
.PHONY: docs docs-draft docs-local clean hugo-get hugo-tidy lint-markdown link-check
5540

5641
docs:
5742
${HUGO}
5843

59-
clean:
60-
if [[ -d ${PWD}/public ]] ; then rm -rf ${PWD}/public && echo "Removed public directory" ; else echo "Did not find a public directory to remove" ; fi
61-
6244
watch:
6345
${HUGO} --bind 0.0.0.0 -p 1313 server --disableFastRender
6446

65-
watch-drafts:
47+
drafts:
6648
${HUGO} --bind 0.0.0.0 -p 1313 server -D --disableFastRender
6749

68-
link-check:
69-
${MARKDOWNLINKCHECK} $(shell find content -name '*.md')
70-
71-
lint-markdown:
72-
${MARKDOWNLINT} -c .markdownlint.json -- content
50+
clean:
51+
[ -d "public" ] && rm -rf "public"
7352

74-
# Commands used by Netlify CI
75-
hugo-mod:
53+
hugo-get:
7654
hugo mod get $(THEME_MODULE)@v$(THEME_VERSION)
7755

7856
hugo-tidy:
7957
hugo mod tidy
8058

81-
build-production:
82-
hugo --gc -e production
59+
hugo-update: hugo-get hugo-tidy
8360

84-
build-staging:
85-
hugo --gc -e staging
86-
87-
build-dev:
88-
hugo --gc -e development
61+
lint-markdown:
62+
${MARKDOWNLINT} -c .markdownlint.yaml -- content
8963

90-
deploy-preview: hugo-mod
91-
hugo --gc -b ${NETLIFY_DEPLOY_URL}/nginx-ingress-controller/
64+
link-check:
65+
${MARKDOWNLINKCHECK} $(shell find content -name '*.md')

docs/README.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,38 +30,37 @@ To work on documentation, create a feature branch in a forked repository then ta
3030

3131
The documentation is published from the latest public release branch. If your changes require immediate publication, create a pull request to cherry-pick changes from `main` to the public release branch.
3232

33-
## Developing documentation locally
33+
## Develop documentation locally
3434

35-
To build the documentation locally, run the `make` command inside this `/site/` directory:
35+
To build the documentation locally, use the `make` command in the documentation folder with these targets:
3636

3737
```text
38-
make docs - Builds the documentation set with the output as the '/public' directory
39-
make clean - Removes the local '/public/' directory
40-
make watch - Starts a local Hugo server for live previews
41-
make watch-drafts - Starts a local Hugo server for live previews, including documentation marked with 'draft: true'
42-
make link-check - Check for any broken links in the documentation
43-
make lint-markdown - Runs markdownlint to identify possible markdown formatting issues
38+
make docs - Builds the documentation
39+
make watch - Runs a local Hugo server to automatically preview changes
40+
make drafts - Runs a local Hugo server, and displays documentation marked as drafts
41+
make clean - Removes the output 'public' directory created by Hugo
42+
make hugo-get - Updates the go module file with the latest version of the theme
43+
make hugo-tidy - Removes unnecessary dependencies from the go module file
44+
make hugo-update - Runs the hugo-get and hugo-tidy targets in sequence
45+
make lint-markdown - Runs markdownlint on the content folder
46+
make link-check - Runs markdown-link-check on all Markdown files
4447
```
4548

46-
The `watch` options automatically reload the Hugo server, allowing you to view updates as you work.
47-
48-
> **Note**: The documentation uses build environments to control the baseURL used for things like internal references and static resources. The configuration for each environment can be found in the `config` directory. When running Hugo you can specify the environment and baseURL, but it's unnecessary.
49-
5049
## Adding new documentation
5150

52-
### Using Hugo to generate a new documentation file
51+
### Generate a new documentation file using Hugo
5352

54-
To create a new documentation file with the pre-configured Hugo front-matter for the task template, run the following command inside this `/site` directory:
53+
To create a new documentation file containing the pre-configured Hugo front-matter with the task template, **run the following command in the documentation directory**:
5554

56-
`hugo new <SECTIONNAME>/<FILENAME>.md`
55+
`hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>`
5756

5857
For example:
5958

6059
```shell
6160
hugo new getting-started/install.md
6261
```
6362

64-
The default template (task) should be used for most pages. For other content templates, you can use the `--kind` flag:
63+
The default template -- task -- should be used for most documentation. To create documentation using the other content templates, you can use the `--kind` flag:
6564

6665
```shell
6766
hugo new tutorials/deploy.md --kind tutorial
@@ -119,7 +118,7 @@ Use the `img` [shortcode](#using-hugo-shortcodes) to add images into your docume
119118
120119
### Using Hugo shortcodes
121120

122-
[Hugo shortcodes](/docs/themes/f5-hugo/layouts/shortcodes/) are used to format callouts, add images, and reuse content across different pages.
121+
[Hugo shortcodes](https://github.com/nginxinc/nginx-hugo-theme/tree/main/layouts/shortcodes) are used to format callouts, add images, and reuse content across different pages.
123122

124123
For example, to use the `note` callout:
125124

0 commit comments

Comments
 (0)