You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Makefile
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,9 @@ nodrafts: bundle
29
29
production: bundle
30
30
hugo --gc --minify --enableGitInfo
31
31
32
+
static: bundle
33
+
hugo --gc --enableGitInfo --cleanDestinationDir
34
+
32
35
deploy_preview: bundle
33
36
hugo --gc --minify --enableGitInfo --buildFuture
34
37
@@ -38,6 +41,9 @@ serve_ignore_vendor: bundle
38
41
test_theme: bundle
39
42
HUGO_MODULE_WORKSPACE=hugo.work hugo server --buildDrafts --noHTTPCache --buildFuture --ignoreVendorPaths "github.com/chef/chef-docs-theme"
40
43
44
+
test_theme_production: bundle
45
+
HUGO_MODULE_WORKSPACE=hugo.work hugo server --buildDrafts --noHTTPCache --buildFuture --ignoreVendorPaths "github.com/chef/chef-docs-theme" --environment production
46
+
41
47
# https://gohugo.io/troubleshooting/audit/
42
48
audit: bundle
43
49
HUGO_MINIFY_TDEWOLFF_HTML_KEEPCOMMENTS=true HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true hugo && grep -inorE "<\!-- raw HTML omitted -->|ZgotmplZ|\[i18n\]|\(<nil>\)|(<nil>)|hahahugo" public/
@@ -18,7 +18,7 @@ If you don't find style guidance in the Chef Documentation Style Guide, use [Goo
18
18
## Distributed documentation
19
19
20
20
The Chef documentation source is highly distributed and depends on [Hugo modules](https://gohugo.io/hugo-modules/) to pull in documentation from other Chef repositories.
21
-
The content from those repositories is [vendored](#hugo-vendoring) in chef-web-docs.
21
+
The content from those repositories is [vendored](#update-documentation-from-other-repositories) in chef-web-docs.
22
22
23
23
To make changes to the content in those repositories, submit pull requests to the appropriate repository. don't submit pull requests to the vendored files in chef-web-docs. We will update those changes after they're merged or after a new version of a product is released.
24
24
@@ -70,28 +70,15 @@ fix build errors before we merge, so you don't have to
70
70
worry about passing all of the CI checks, but it might add an extra
71
71
few days. The important part is submitting your change.
72
72
73
-
## Edit on GitHub links
74
-
75
-
We use a partial `edit_on_github.html` to add "Edit on GitHub" links to each page.
76
-
77
-
Each page should have a `gh_repo` parameter set to the value of the GitHub repository
78
-
that the page comes from. For example, `gh_repo = "chef-server"`
79
-
80
-
Each repository with documentation has a `config.toml` file with a `params.<REPOSITORY>`
81
-
map and a `gh_path` parameter set to the path of the docs content directory in
82
-
that repository.
83
-
84
-
The `edit_on_github` partial appends the page file name to the end of `gh_path`
85
-
parameter and adds the link to the text of the page.
@@ -123,61 +110,6 @@ To clean your local development environment:
123
110
in addition to the functions of `make clean` described above. Those node
124
111
modules will be reinstalled the next time you run `make serve`.
125
112
126
-
## Site theme
127
-
128
-
The theme for this site is deployed from the [chef/chef-docs-theme](https://github.com/chef/chef-docs-theme/) repository.
129
-
130
-
### Node modules
131
-
132
-
The Node modules defined in the `package.json` file are sourced from the `package.hugo.json` file in the `chef/chef-docs-theme` repository.
133
-
To update these Node dependencies, update them in `chef/chef-docs-theme`, then [update the theme and the `package.json` file](#update-theme) in this repository.
134
-
135
-
### Local theme testing
136
-
137
-
You can test local changes made to the chef-docs-theme repository and preview those changes using Hugo's local development server.
138
-
To do this, create a Go workspace file that modifies the source of Hugo's modules, source the workspace file, and start the local server.
139
-
140
-
For example:
141
-
142
-
1. Create a `hugo.work` file in root of this project.
143
-
144
-
1. Add the following config information to the `hugo.work` file:
145
-
146
-
```go
147
-
go1.22
148
-
149
-
use .
150
-
use ../path/to/local/chef-docs-theme
151
-
```
152
-
153
-
1. Start the Hugo local server:
154
-
155
-
```sh
156
-
make test_theme
157
-
```
158
-
159
-
This command adds the `hugo.work` file to the Hugo workspace and then ignores the contents of `chef-docs-theme` repo in the `_vendor` directory.
160
-
161
-
### Test theme branch
162
-
163
-
You can target a Git commit, branch, or tag when importing a module. This allows you to push a test branch up to `chef/chef-docs-theme` and then import it into this repository for local testing.
164
-
165
-
For example:
166
-
167
-
```sh
168
-
hugo mod get -u github.com/chef/chef-docs-theme@<GIT_COMMIT_SHA>
169
-
```
170
-
171
-
or
172
-
173
-
```sh
174
-
hugo mod get -u github.com/chef/chef-docs-theme@<GIT_BRANCH>
175
-
```
176
-
177
-
### Update theme
178
-
179
-
Run `make update_theme` to update the chef-docs-theme to the latest commit. This updates the theme and the theme's node dependencies.
180
-
181
113
## Build and preview the docs
182
114
183
115
You can preview documentation using one of the following:
@@ -192,6 +124,7 @@ This is automatic for members of the Chef GitHub organization; the Documentation
192
124
193
125
### Build and preview the docs locally
194
126
127
+
-[Install the site dependencies](#local-development-environment).
195
128
- Run `make serve`
196
129
- go to [http://localhost:1313](http://localhost:1313)
197
130
@@ -202,7 +135,7 @@ This is useful for previewing redirects configured in the `netlify.toml` file.
202
135
203
136
Requirements:
204
137
205
-
- all the requirements for building this site locally
138
+
-[all the requirements for building this site locally](#local-development-environment)
Run `netlify dev` to preview the site using the Netlify CLI.
@@ -214,89 +147,74 @@ Run `netlify dev` to preview the site using the Netlify CLI.
214
147
Some Chef documentation is stored in private repositories so this option is only
215
148
available to Progress Chef employees.
216
149
217
-
## Hugo vendoring
150
+
## Update documentation from other repositories
218
151
219
-
[Vendoring](https://gohugo.io/commands/hugo_mod_vendor/) stores all of the module content
220
-
from other repositories in the `_vendor` directory at the commit specified by
221
-
the `go.mod` file. WhenHugo builds the documentation, it will grab content from
222
-
the `_vendor` directory instead of the original repository OR a local copy of a
223
-
that repository. To see which commits the vendored files reference, see the
224
-
`_vendor/modules.txt` file.
152
+
We [vendor](https://gohugo.io/commands/hugo_mod_vendor/) most documentation, some Javascript dependencies, and our site theme in the `_vendor` directory.
225
153
226
-
To vendor the modules in chef-web-docs, run `hugo mod vendor`.
154
+
### Update vendored content
227
155
228
-
To update the vendored modules, first update the [Hugo module(s)](#update-hugo-modules),
229
-
then run `hugo mod vendor`.
156
+
To updated vendored content, follow these steps:
230
157
231
-
To ignore the vendored files in a Hugo build, run `make serve_ignore_vendor`. This
232
-
is the same as `make serve` except it adds the `--ignoreVendor` flag. This will
233
-
build the documentation from the GitHub repositories or from a local copy of a repository
234
-
if the `go.mod` file specifies pulling content from a local repository. (see above)
158
+
1. Update the content from source repository using [`hugo mod get`](https://gohugo.io/commands/hugo_mod_get/). See the list of modules in the [`go.mod` file](https://github.com/chef/chef-web-docs/blob/main/go.mod) or the [module config file](https://github.com/chef/chef-web-docs/blob/main/config/_default/module.toml).
235
159
236
-
### UpdateHugo modules
160
+
To update content to the latest commit in the main branch:
237
161
238
-
Hugo modules are pinned to a particular commit of the master branch in their repository.
239
-
If you look in the `go.mod` and `go.sum` files, you'll notice that each repository
240
-
specifies a git commit timestamp and SHA.
162
+
```sh
163
+
hugo mod get -u github.com/<ORG>/<REPO>/<SUBDIRECTORY>
164
+
```
241
165
242
-
To update a particular repo, run:
166
+
You can also update a module to a particular Git SHA, branch, or tag. For example:
243
167
244
-
```bash
245
-
hugo mod get github.com/chef/repo_to_update/subdirectory
246
-
hugo mod clean
247
-
```
168
+
```sh
169
+
hugo mod get -u github.com/<ORG>/<REPO>/<SUBDIRECTORY>@<GIT_SHA>
170
+
```
248
171
249
-
Then [vendor](#hugo-vendoring) the documentation:
172
+
1. Update the vendored content.
250
173
251
-
```bash
252
-
hugo mod vendor
253
-
```
174
+
```sh
175
+
rm -rf _vendor
176
+
hugo mod tidy
177
+
hugo mod vendor
178
+
```
254
179
255
180
For example, to update the chef-workstation repository:
256
181
257
182
```bash
258
-
hugo mod get github.com/chef/chef-workstation/docs-chef-io
259
-
hugo mod clean
183
+
hugo mod get -u github.com/chef/chef-workstation/docs-chef-io
184
+
rm -rf _vendor
185
+
hugo mod tidy
260
186
hugo mod vendor
261
187
```
262
188
263
189
This will update that repository to the most recent commit.
264
190
265
-
You can also update a module to a commit version number. For example:
191
+
You can also update a module to a repository tag. For example:
And you can update a module to a Git commit. For example:
274
201
275
202
```sh
276
203
hugo mod get github.com/chef/chef-workstation/docs-chef-io@0ad84dd5fa8
277
-
hugo mod clean
204
+
rm -rf _vendor
205
+
hugo mod tidy
278
206
hugo mod vendor
279
207
```
280
208
281
-
The `hugo mod clean` command removes references to commits in the
282
-
`go.mod` and `go.sum` files that are no longer relevant.
283
-
284
-
See Hugo's [documentation](https://gohugo.io/hugo-modules/use-modules/#update-modules)
285
-
for additional information about updating HugoModules.
286
-
287
-
### Update chef-docs-theme module
288
-
289
-
The theme for this site is sourced from [chef/chef-docs-theme](https://github.com/chef/chef-docs-theme).
290
-
291
-
Run `make update_theme` to update the theme module and Nodepackage dependencies.
209
+
See [Hugo's documentation](https://gohugo.io/hugo-modules/use-modules/#update-modules) for additional information about updating Hugo Modules.
292
210
293
211
### What if Hugo doesn't update a module
294
212
295
213
Sometimes Hugo and Git are a bit difficult and won't update a module cleanly or will leave
296
214
references to older commits of a module in the `go.sum` file.
297
215
298
216
If you get an error indicating that Git can't find a repository that's already
299
-
added as a module, try restarting your computer.
217
+
added as a module, try cleaning your Hugo cache using `hugo mod clean`, and if that doesn't work, restart your computer.
300
218
301
219
If you still having trouble, try rebuilding the `go.mod` and `go.sum` files:
302
220
@@ -313,6 +231,82 @@ If you still having trouble, try rebuilding the `go.mod` and `go.sum` files:
313
231
and `go.sum` files, but it can't hurt either.
314
232
1. Vendor the modules in chef-web-docs, `hugo mod vendor`.
315
233
234
+
## Docs site theme
235
+
236
+
The theme for this site is sourced from [chef/chef-docs-theme](https://github.com/chef/chef-docs-theme).
237
+
238
+
### Update theme
239
+
240
+
Run `make update_theme` to update the site theme.
241
+
242
+
### Update theme Javascript dependencies
243
+
244
+
We source Javascript dependencies in the chef/chef-docs-theme repository using Node and GitHub.
245
+
246
+
#### Node dependencies
247
+
248
+
To update first-level Node dependencies:
249
+
250
+
1. Update the dependency in the [chef/chef-docs-theme package.hugo.json file](https://github.com/chef/chef-docs-theme/blob/main/package.hugo.json).
251
+
2. Update the [package.json file in chef/chef-docs-theme](https://github.com/chef/chef-docs-theme/blob/main/package.json) by running `hugo mod npm pack`
252
+
3. Commit the package file updates to main in chef/chef-docs-theme.
253
+
4. Update the theme in this repo by running `make update_theme`.
254
+
255
+
To update transitive Node dependencies in this repo:
256
+
257
+
- Run `npm update`.
258
+
259
+
#### Javascript dependencies imported with Hugo
260
+
261
+
We use Hugo to import JavaScript dependencies from GitHub repositories. You can see the full list in either the chef/chef-docs-theme [go.mod file](https://github.com/chef/chef-docs-theme/blob/main/go.mod) or the [`hugo.toml` file](https://github.com/chef/chef-docs-theme/blob/main/hugo.toml).
262
+
263
+
To update these dependencies, follow these steps:
264
+
265
+
1. Update the dependency in the go.mod file in chef/chef-docs-theme using the [`hugo mod get -u` command](https://gohugo.io/commands/hugo_mod_get/).
266
+
2. Tidy the go.sum file with `hugo mod tidy`.
267
+
3. Commit the changes to chef/chef-docs-theme
268
+
4. Update the theme contents in this repo with `make update_theme`.
269
+
270
+
### Local theme testing
271
+
272
+
You can testlocal changes made to the chef-docs-theme repository and preview those changes using Hugo's local development server.
273
+
To do this, create a Go workspace file that modifies the source of Hugo's modules, source the workspace file, and start the local server.
274
+
275
+
For example:
276
+
277
+
1. Create a `hugo.work` file in root of this project.
278
+
279
+
1. Add the following config information to the `hugo.work` file:
280
+
281
+
```go
282
+
go 1.22
283
+
284
+
use .
285
+
use ../path/to/local/chef-docs-theme
286
+
```
287
+
288
+
1. Start the Hugo local server:
289
+
290
+
```sh
291
+
make test_theme
292
+
```
293
+
294
+
This command adds the `hugo.work` file to the Hugo workspace and then ignores the contents of `chef-docs-theme` repo in the `_vendor` directory.
295
+
296
+
## Edit on GitHub links
297
+
298
+
We use a partial `edit_on_github.html` to add "Edit on GitHub" links to each page.
299
+
300
+
Each page should have a `gh_repo` parameter set to the value of the GitHub repository
301
+
that the page comes from. For example, `gh_repo = "chef-server"`
302
+
303
+
Each repository with documentation has a `config.toml` file with a `params.<REPOSITORY>`
304
+
map and a `gh_path` parameter set to the path of the docs content directory in
305
+
that repository.
306
+
307
+
The `edit_on_github` partial appends the page file name to the end of `gh_path`
308
+
parameter and adds the link to the text of the page.
309
+
316
310
## Release notes
317
311
318
312
Release notes are added to release notes pages using Hugo's [`resource.getRemote` function](https://gohugo.io/hugo-pipes/introduction/#get-resource-with-resourcesget-and-resourcesgetremote) and content from [https://omnitruck.chef](omnitruck.chef.io) and [https://packages.chef.io](packages.chef.io).
@@ -361,7 +355,7 @@ The commit history of this repo before February 12, 2016 has been archived to th
361
355
We love getting feedback. You can use:
362
356
363
357
- Each page has a feedback form at the bottom of the page.
364
-
- Email --- Send an email to chef-docs@progress.comfor documentation bugs,
358
+
- Email --- Send an email to <[email protected]>for documentation bugs,
365
359
ideas, thoughts, and suggestions. This email address isn't a
366
360
support email address, however. If you need support, contact Chef
0 commit comments