Skip to content

Commit c89db8f

Browse files
authoredApr 9, 2024··
Remove Hugo theme from this repo (#4261)
* 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]>
1 parent 0efb075 commit c89db8f

File tree

179 files changed

+32258
-2945
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+32258
-2945
lines changed
 

‎Makefile

+29-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
# we use pushd/popd here, and /bin/sh of our chefes/buildkite image is not bash
22
# so we have to override the default shell here
3-
SHELL=bash
3+
SHELL=bash -eou pipefail
44

5+
# bundle is also executed from other repositories when people run local previews
56
bundle:
6-
pushd themes/docs-new && make bundle && popd
7+
npm install
78

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
1015
rm -rf resources/
1116
rm -rf public/
12-
hugo mod clean
17+
18+
clean_all: clean clean_hugo_mod
1319

1420
serve: bundle
1521
hugo server --buildDrafts --noHTTPCache --buildFuture
@@ -21,14 +27,28 @@ nodrafts: bundle
2127
hugo server --noHTTPCache --buildFuture
2228

2329
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
2534

2635
serve_ignore_vendor: bundle
2736
hugo server --buildDrafts --noHTTPCache --buildFuture --ignoreVendorPaths github.com/**
2837

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>\)|(&lt;nil&gt;)|hahahugo" public/
44+
2945
lint: bundle
3046
hugo -D
3147

48+
update_theme:
49+
hugo mod get -u github.com/chef/chef-docs-theme
50+
hugo mod npm pack
51+
3252
## See:
3353
## - https://cspell.org/docs/getting-started/
3454
## - https://cspell.org/configuration/
@@ -53,15 +73,15 @@ resource_files:
5373
# Verifies that all Cookstyle MD pages exist
5474
verify_cookstyle_pages:
5575
dataDir=generated/_vendor/github.com/chef/cookstyle/docs-chef-io/assets/cookstyle; \
56-
markdownDir=generated/generated_content/workstation/cookstyle; \
76+
markdownDir=generated/generated_content/workstation/cookstyle/cops; \
5777
for f in $$(ls $${dataDir}); \
5878
do mdFile="$${f/.yml/.md}"; \
5979
mdFilePath="$${markdownDir}/$${mdFile/cops_/}"; \
6080
if test ! -f "$${mdFilePath}"; then \
6181
echo "$${mdFilePath} does not exist."; \
6282
fi; \
6383
done; \
64-
if test ! -f "generated/generated_content/workstation/cookstyle/cops.md"; then \
65-
echo "generated/generated_content/workstation/cookstyle/cops.md does not exist."; \
84+
if test ! -f "generated/generated_content/workstation/cookstyle/cops/_index.md"; then \
85+
echo "generated/generated_content/workstation/cookstyle/cops/_index.md does not exist."; \
6686
fi; \
6787

‎README.md

+112-48
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,23 @@ The content from those repositories is [vendored](#hugo-vendoring) in chef-web-d
2222

2323
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.
2424

25-
## GitHub repositories with documentation
25+
## GitHub repositories
2626

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)
2930
- 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)
3031
- 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)
3333
- 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).
4642

4743
## DCO signoff
4844

@@ -74,6 +70,20 @@ fix build errors before we merge, so you don't have to
7470
worry about passing all of the CI checks, but it might add an extra
7571
few days. The important part is submitting your change.
7672

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+
7787
## Local development environment
7888

7989
The Chef Documentation website is built using:
@@ -86,35 +96,91 @@ The Chef Documentation website is built using:
8696
To install Hugo, NPM, and Go on Windows, run:
8797

8898
```ps1
89-
choco install hugo-extended nodejs golang
99+
choco install hugo-extended nodejs golang sass
90100
```
91101

92-
To install Hugo, NPM, and Go on macOS, run:
102+
To install Hugo, NPM, Go, and Dart Sass on macOS, run:
93103

94104
```sh
95-
brew install hugo node go
105+
brew install hugo node go sass/sass/sass
96106
```
97107

98108
To install Hugo on Ubuntu, run:
99109

100110
- `apt install -y build-essential`
101111
- `snap install node --classic --channel=12`
102112
- `snap install hugo --channel=extended`
113+
- `snap install dart-sass`
103114

104115
### Troubleshoot your development environment
105116

106117
To clean your local development environment:
107118

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`.
110121

111122
- Run `make clean_all` to delete the node modules used to build this site
112123
in addition to the functions of `make clean` described above. Those node
113124
modules will be reinstalled the next time you run `make serve`.
114125

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+
go 1.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+
115181
## Build and preview the docs
116182
117-
There are two ways to preview documentation:
183+
You can preview documentation using one of the following:
118184
119185
- Submit a PR and look at the Netlify preview.
120186
- Build the documentation locally.
@@ -198,55 +264,53 @@ This will update that repository to the most recent commit.
198264
199265
You can also update a module to a commit version number. For example:
200266
201-
```go
267+
```sh
202268
hugo mod get github.com/chef/chef-workstation/docs-chef-io@20.6.62
203269
hugo mod clean
204270
hugo mod vendor
205271
```
206272
207273
And you can update a module to a Git commit. For example:
208274
209-
```go
275+
```sh
210276
hugo mod get github.com/chef/chef-workstation/docs-chef-io@0ad84dd5fa8
211277
hugo mod clean
212278
hugo mod vendor
213279
```
214280
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-
223281
The `hugo mod clean` command removes references to commits in the
224282
`go.mod` and `go.sum` files that are no longer relevant.
225283
226284
See Hugo's [documentation](https://gohugo.io/hugo-modules/use-modules/#update-modules)
227285
for additional information about updating Hugo Modules.
228286

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 Node package dependencies.
292+
229293
### What if Hugo doesn't update a module
230294
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.
233297

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 Git can't find a repository that's already
299+
added as a module, try restarting your computer.
236300

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:
238302

239-
1. Delete the go.mod and go.sum files.
303+
1. Delete the `go.mod` and `go.sum` files.
240304
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.
242306
1. Update the references to the other GitHub repositories, `hugo mod get -u`.
243307
1. The previous step will update all modules to the latest commit of their source
244308
repositories.
245309
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
247311
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.
250314
1. Vendor the modules in chef-web-docs, `hugo mod vendor`.
251315

252316
## Release notes
@@ -255,19 +319,19 @@ Release notes are added to release notes pages using Hugo's [`resource.getRemote
255319
256320
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).
257321
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`.
259323
260324
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`.
261325
262326
Release versions for all other Chef products come from `https://omnitruck.chef.io/stable/<PRODUCT>/versions/all`.
263327
264328
Each release note page comes from a Markdown file from `https://packages.chef.io/release-notes/<PRODUCT>/<VERSION>.md`.
265329
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."
267331

268-
### Previewing release notes locally
332+
### Preview release notes locally
269333

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.
271335
272336
Run `make production` to build and preview the release notes.
273337
@@ -298,7 +362,7 @@ We love getting feedback. You can use:
298362

299363
- Each page has a feedback form at the bottom of the page.
300364
- Email --- Send an email to chef-docs@progress.com for documentation bugs,
301-
ideas, thoughts, and suggestions. This email address is not a
365+
ideas, thoughts, and suggestions. This email address isn't a
302366
support email address, however. If you need support, contact Chef
303367
support.
304368
- Pull request --- Submit a PR to this repo using either of the two

0 commit comments

Comments
 (0)
Please sign in to comment.