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
* Remove Hugo theme from this repo and source from
chef/chef-docs-theme
Signed-off-by: Ian Maddaus <[email protected]>
* remove theme from vendored files
Signed-off-by: Ian Maddaus <[email protected]>
* Netlify config
Signed-off-by: Ian Maddaus <[email protected]>
* Add theme to vendor
Signed-off-by: Ian Maddaus <[email protected]>
* WIP
Signed-off-by: Ian Maddaus <[email protected]>
* Remove additional layouts
Signed-off-by: Ian Maddaus <[email protected]>
* Add test_theme make command
Signed-off-by: Ian Maddaus <[email protected]>
* Update code examples
Signed-off-by: Ian Maddaus <[email protected]>
* More updates
Signed-off-by: Ian Maddaus <[email protected]>
* Lints
Signed-off-by: Ian Maddaus <[email protected]>
* Add audit make command
Signed-off-by: Ian Maddaus <[email protected]>
* Minor corrections
Signed-off-by: Ian Maddaus <[email protected]>
* Lints
Signed-off-by: Ian Maddaus <[email protected]>
* Update Hugo theme
Signed-off-by: Ian Maddaus <[email protected]>
---------
Signed-off-by: Ian Maddaus <[email protected]>
Copy file name to clipboardexpand all lines: Makefile
+29-9
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,21 @@
1
1
# we use pushd/popd here, and /bin/sh of our chefes/buildkite image is not bash
2
2
# so we have to override the default shell here
3
-
SHELL=bash
3
+
SHELL=bash -eou pipefail
4
4
5
+
# bundle is also executed from other repositories when people run local previews
5
6
bundle:
6
-
pushd themes/docs-new && make bundle &&popd
7
+
npm install
7
8
8
-
clean_all:
9
-
pushd themes/docs-new && make clean_all &&popd
9
+
clean_hugo_mod:
10
+
hugo mod clean --all
11
+
12
+
clean:
13
+
rm -rf node_modules
14
+
rm -rf dart-sass
10
15
rm -rf resources/
11
16
rm -rf public/
12
-
hugo mod clean
17
+
18
+
clean_all: clean clean_hugo_mod
13
19
14
20
serve: bundle
15
21
hugo server --buildDrafts --noHTTPCache --buildFuture
@@ -21,14 +27,28 @@ nodrafts: bundle
21
27
hugo server --noHTTPCache --buildFuture
22
28
23
29
production: bundle
24
-
hugo server --buildDrafts --noHTTPCache --buildFuture --environment production
30
+
hugo --gc --minify --enableGitInfo
31
+
32
+
deploy_preview: bundle
33
+
hugo --gc --minify --enableGitInfo --buildFuture
25
34
26
35
serve_ignore_vendor: bundle
27
36
hugo server --buildDrafts --noHTTPCache --buildFuture --ignoreVendorPaths github.com/**
28
37
38
+
test_theme: bundle
39
+
HUGO_MODULE_WORKSPACE=hugo.work hugo server --buildDrafts --noHTTPCache --buildFuture --ignoreVendorPaths "github.com/chef/chef-docs-theme"
40
+
41
+
# https://gohugo.io/troubleshooting/audit/
42
+
audit: bundle
43
+
HUGO_MINIFY_TDEWOLFF_HTML_KEEPCOMMENTS=true HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true hugo && grep -inorE "<\!-- raw HTML omitted -->|ZgotmplZ|\[i18n\]|\(<nil>\)|(<nil>)|hahahugo" public/
Copy file name to clipboardexpand all lines: README.md
+112-48
Original file line number
Diff line number
Diff line change
@@ -22,27 +22,23 @@ The content from those repositories is [vendored](#hugo-vendoring) in chef-web-d
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
25
-
## GitHub repositories with documentation
25
+
## GitHub repositories
26
26
27
-
- Chef Automate: [<https://github.com/chef/automate/tree/main/components/docs-chef-io>](https://github.com/chef/automate/tree/main/components/docs-chef-io
28
-
)
27
+
We source documentation from the following repositories:
28
+
29
+
- Chef Automate: [<https://github.com/chef/automate/tree/main/components/docs-chef-io>](https://github.com/chef/automate/tree/main/components/docs-chef-io)
29
30
- Chef Infra Server: [<https://github.com/chef/chef-server/tree/main/docs-chef-io>](https://github.com/chef/chef-server/tree/main/docs-chef-io)
30
31
- Chef Workstation [<https://github.com/chef/chef-workstation/tree/main/docs-chef-io>](https://github.com/chef/chef-workstation/tree/main/docs-chef-io)
31
-
- Chef Desktop [<https://github.com/chef/desktop-config/tree/main/docs-chef-io>](https://github.com/chef/desktop-config/tree/main/docs-chef-io
32
-
)
32
+
- Chef Desktop [<https://github.com/chef/desktop-config/tree/main/docs-chef-io>](https://github.com/chef/desktop-config/tree/main/docs-chef-io)
33
33
- Chef Supermarket [<https://github.com/chef/supermarket/tree/main/docs-chef-io>](https://github.com/chef/supermarket/tree/main/docs-chef-io)
34
-
- Chef Habitat [<https://github.com/habitat-sh/habitat/tree/main/components/docs-chef-io>](https://github.com/habitat-sh/habitat/tree/main/components/docs-chef-io
35
-
)
36
-
- Chef InSpec [<https://github.com/inspec/inspec/tree/main/docs-chef-io>](https://github.com/inspec/inspec/tree/main/docs-chef-io
37
-
)
38
-
- Chef InSpec AWS [<https://github.com/inspec/inspec-aws/tree/main/docs-chef-io>](https://github.com/inspec/inspec-aws/tree/main/docs-chef-io
39
-
)
40
-
- Chef InSpec Azure [<https://github.com/inspec/inspec-azure/tree/main/docs-chef-io>](https://github.com/inspec/inspec-azure/tree/main/docs-chef-io
41
-
)
42
-
- Chef InSpec AliCloud [<https://github.com/inspec/inspec-alicloud/tree/main/docs-chef-io>](https://github.com/inspec/inspec-alicloud/tree/main/docs-chef-io
43
-
)
44
-
- Chef InSpec Habitat [<https://github.com/inspec/inspec-habitat/tree/main/docs-chef-io>](https://github.com/inspec/inspec-habitat/tree/main/docs-chef-io
45
-
)
34
+
- Chef Habitat [<https://github.com/habitat-sh/habitat/tree/main/components/docs-chef-io>](https://github.com/habitat-sh/habitat/tree/main/components/docs-chef-io)
35
+
- Chef InSpec [<https://github.com/inspec/inspec/tree/main/docs-chef-io>](https://github.com/inspec/inspec/tree/main/docs-chef-io)
36
+
- Chef InSpec AWS [<https://github.com/inspec/inspec-aws/tree/main/docs-chef-io>](https://github.com/inspec/inspec-aws/tree/main/docs-chef-io)
37
+
- Chef InSpec Azure [<https://github.com/inspec/inspec-azure/tree/main/docs-chef-io>](https://github.com/inspec/inspec-azure/tree/main/docs-chef-io)
38
+
- Chef InSpec AliCloud [<https://github.com/inspec/inspec-alicloud/tree/main/docs-chef-io>](https://github.com/inspec/inspec-alicloud/tree/main/docs-chef-io)
39
+
- Chef InSpec Habitat [<https://github.com/inspec/inspec-habitat/tree/main/docs-chef-io>](https://github.com/inspec/inspec-habitat/tree/main/docs-chef-io)
40
+
41
+
We source the theme from this site from [<https://github.com/chef/chef-docs-theme>](https://github.com/chef/chef-docs-theme).
46
42
47
43
## DCO signoff
48
44
@@ -74,6 +70,20 @@ fix build errors before we merge, so you don't have to
74
70
worry about passing all of the CI checks, but it might add an extra
75
71
few days. The important part is submitting your change.
76
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.
86
+
77
87
## Local development environment
78
88
79
89
The Chef Documentation website is built using:
@@ -86,35 +96,91 @@ The Chef Documentation website is built using:
86
96
To install Hugo, NPM, and Go on Windows, run:
87
97
88
98
```ps1
89
-
choco install hugo-extended nodejs golang
99
+
choco install hugo-extended nodejs golang sass
90
100
```
91
101
92
-
To install Hugo, NPM, and Go on macOS, run:
102
+
To install Hugo, NPM, Go, and Dart Sass on macOS, run:
93
103
94
104
```sh
95
-
brew install hugo node go
105
+
brew install hugo node go sass/sass/sass
96
106
```
97
107
98
108
To install Hugo on Ubuntu, run:
99
109
100
110
-`apt install -y build-essential`
101
111
-`snap install node --classic --channel=12`
102
112
-`snap install hugo --channel=extended`
113
+
-`snap install dart-sass`
103
114
104
115
### Troubleshoot your development environment
105
116
106
117
To clean your local development environment:
107
118
108
-
- Run `make clean` to delete the sass files, javascript, and fonts. These will
109
-
be rebuilt the next time you run `make serve`.
119
+
- Run `make clean_all` to delete the SASS files, Javascript, and fonts.
120
+
Hugo rebuilds these the next time you run `make serve`.
110
121
111
122
- Run `make clean_all` to delete the node modules used to build this site
112
123
in addition to the functions of `make clean` described above. Those node
113
124
modules will be reinstalled the next time you run `make serve`.
114
125
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
+
115
181
## Build and preview the docs
116
182
117
-
There are two ways to preview documentation:
183
+
You can preview documentation using one of the following:
118
184
119
185
- Submit a PR and look at the Netlify preview.
120
186
- Build the documentation locally.
@@ -198,55 +264,53 @@ This will update that repository to the most recent commit.
198
264
199
265
You can also update a module to a commit version number. For example:
200
266
201
-
```go
267
+
```sh
202
268
hugo mod get github.com/chef/chef-workstation/docs-chef-io@20.6.62
203
269
hugo mod clean
204
270
hugo mod vendor
205
271
```
206
272
207
273
And you can update a module to a Git commit. For example:
208
274
209
-
```go
275
+
```sh
210
276
hugo mod get github.com/chef/chef-workstation/docs-chef-io@0ad84dd5fa8
211
277
hugo mod clean
212
278
hugo mod vendor
213
279
```
214
280
215
-
To update all Hugo modules at the same time, run:
216
-
217
-
```go
218
-
hugo mod get -u
219
-
hugo mod clean
220
-
hugo mod vendor
221
-
```
222
-
223
281
The `hugo mod clean` command removes references to commits in the
224
282
`go.mod` and `go.sum` files that are no longer relevant.
225
283
226
284
See Hugo's [documentation](https://gohugo.io/hugo-modules/use-modules/#update-modules)
227
285
for additional information about updating HugoModules.
228
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.
292
+
229
293
### WhatifHugo doesn't update a module
230
294
231
-
Sometimes Hugo and Git can be a bit difficult and will not update a module cleanly or will leave
232
-
references to older commits of a module in the go.sum file.
295
+
Sometimes Hugo and Git are a bit difficult and won't update a module cleanly or will leave
296
+
references to older commits of a module in the `go.sum` file.
233
297
234
-
If you get an error indicating that a Git cannot find a repository that's already
235
-
been added as a module, try restarting your computer.
298
+
If you get an error indicating that Gitcan't find a repository that's already
299
+
added as a module, try restarting your computer.
236
300
237
-
If you are still having trouble, try rebuilding the go.mod and go.sum files:
301
+
If you still having trouble, try rebuilding the `go.mod` and `go.sum` files:
238
302
239
-
1. Delete the go.mod and go.sum files.
303
+
1. Delete the `go.mod` and `go.sum` files.
240
304
1. Re-initialize the Hugo modules, `hugo mod init github.com/chef/chef-web-docs`
241
-
This will generate a new, blank go.mod file.
305
+
This will generate a new, blank `go.mod` file.
242
306
1. Update the references to the other GitHub repositories, `hugo mod get -u`.
243
307
1. The previous step will update all modules to the latest commit of their source
244
308
repositories.
245
309
If you don't want that, look at the git history of those files and manually edit the
246
-
go.mod and go.sum files to keep the older commits for the modules that
310
+
`go.mod` and `go.sum` files to keep the older commits for the modules that
247
311
you don't want to update.
248
-
1. Run `hugo mod tidy`. This probably will not do anything on newly initialized go.mod
249
-
and go.sum files, but it cannot hurt either.
312
+
1. Run`hugo mod tidy`. This probably won't do anything on newly initialized go.mod
313
+
and `go.sum` files, but it can't hurt either.
250
314
1. Vendor the modules in chef-web-docs, `hugo mod vendor`.
251
315
252
316
## Release notes
@@ -255,19 +319,19 @@ Release notes are added to release notes pages using Hugo's [`resource.getRemote
255
319
256
320
Chef Automate release versions, release dates, and links to release note Markdown files come from [https://packages.chef.io/releases/current/automate.json](https://packages.chef.io/releases/current/automate.json).
257
321
258
-
Release versions for Chef habitat come from `https://api.github.com/repos/habitat-sh/habitat/releases`.
322
+
Release versions for Chef Habitat come from `https://api.github.com/repos/habitat-sh/habitat/releases`.
259
323
260
324
Release versions for Chef InSpec Cloud resources comes from `_vendor/github.com/inspec/inspec-<PLATFORM>/docs-chef-io/assets/release-notes/inspec-<PLATFORM>/release-dates.json`.
261
325
262
326
Release versions for all other Chef products come from `https://omnitruck.chef.io/stable/<PRODUCT>/versions/all`.
263
327
264
328
Each release note page comes from a Markdown file from `https://packages.chef.io/release-notes/<PRODUCT>/<VERSION>.md`.
265
329
266
-
If a release note Markdown file is not returned from packages.chef.io, the release note for that version will show the text, "This release does not have any release notes."
330
+
If a release note Markdown file isn't returned from packages.chef.io, the release note for that version will show the text, "This release doesn't have any release notes."
267
331
268
-
### Previewing release notes locally
332
+
### Preview release notes locally
269
333
270
-
Release note pages are only generated in the production environment. Running `make serve`will not build any of the content in the release note pages.
334
+
Release note pages are only generated in the production environment. Running`make serve`won't build any of the content in the release note pages.
271
335
272
336
Run `make production` to build and preview the release notes.
273
337
@@ -298,7 +362,7 @@ We love getting feedback. You can use:
298
362
299
363
- Each page has a feedback form at the bottom of the page.
300
364
- Email --- Send an email to chef-docs@progress.comfor documentation bugs,
301
-
ideas, thoughts, and suggestions. This email address is not a
365
+
ideas, thoughts, and suggestions. This email address isn't a
302
366
support email address, however. If you need support, contact Chef
303
367
support.
304
368
- Pull request --- Submit a PR to this repo using either of the two
0 commit comments