Skip to content

Commit 26c49f4

Browse files
committed
docs: harden documentation integrity
1 parent b3aa8ce commit 26c49f4

30 files changed

Lines changed: 294 additions & 677 deletions

CLAUDE.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ This is the documentation website for **Capa** (Cloud Application API) - a Mecha
1414

1515
### Prerequisites
1616

17-
- [Hugo](https://gohugo.io/installation/) (extended version, v0.88.1+ recommended)
18-
- [Node.js](https://nodejs.org/) and npm (for PostCSS/Autoprefixer)
17+
- [Hugo](https://gohugo.io/installation/) Extended `0.145.0`, or Docker
18+
- [Node.js](https://nodejs.org/) 22 and npm (for PostCSS/Autoprefixer)
1919
- Git submodules (for Docsy theme)
2020

2121
### Setup
@@ -25,30 +25,31 @@ This is the documentation website for **Capa** (Cloud Application API) - a Mecha
2525
git submodule update --init --recursive
2626

2727
# Install npm dependencies
28-
npm install
28+
npm ci
29+
npm --prefix themes/docsy install
2930
```
3031

3132
### Local Development
3233

3334
```bash
3435
# Run Hugo development server
35-
hugo server
36+
make dev
3637

3738
# Run with draft content included
38-
hugo server -D
39+
./scripts/hugo.sh server -D
3940

4041
# Run with live reload (default binds to localhost:1313)
41-
hugo server --bind 0.0.0.0
42+
make dev-all
4243
```
4344

4445
### Build
4546

4647
```bash
4748
# Build the site (output goes to the ignored docs/ directory)
48-
hugo --gc
49+
make build
4950

5051
# Build for production
51-
HUGO_ENV="production" hugo --gc
52+
make check
5253
```
5354

5455
The Makefile and npm scripts automatically use the pinned official Hugo
@@ -103,24 +104,25 @@ content/
103104
### Key Configuration Details
104105

105106
- **Base URL**: `https://capa.rxcloud.group/`
106-
- **GitHub repo links**: Point to `https://github.com/capa-cloud/capa`
107-
- **Search**: Uses Google Custom Search Engine (gcs_engine_id)
107+
- **Documentation source links**: Point to `https://github.com/capa-cloud/capa.io` on `master`
108+
- **Related product repository**: `https://github.com/capa-cloud/capa`
109+
- **Search**: Uses Docsy's offline Lunr index
108110
- **Syntax highlighting**: Uses Chroma with "tango" style
109111
- **Markdown engine**: Goldmark with unsafe HTML enabled
110112

111113
### Static Assets
112114

113115
- **Images**: `content/images/` or page bundles
114-
- **Logo**: Configure in `assets/icons/logo.svg` (navbar_logo is currently false)
116+
- **Logo**: Configure in `assets/icons/logo.svg` (`navbar_logo` is enabled)
115117
- **Featured background**: `content/zh/featured-background.jpg`
116118

117119
### Deployment
118120

119121
The site is deployed to GitHub Pages via GitHub Actions (`.github/workflows/deploy.yml`):
120122

121123
1. Push to `master` triggers the workflow
122-
2. Hugo builds the site with `--gc --minify --destination docs`
123-
3. `peaceiris/actions-gh-pages@v3` deploys to the `gh-pages` branch
124+
2. Hugo builds the site with `--gc --minify --cleanDestinationDir --destination docs`
125+
3. `peaceiris/actions-gh-pages@v4` deploys to the `gh-pages` branch
124126
4. Custom domain: `capa.rxcloud.group` (configured via `static/CNAME`)
125127

126128
## Common Tasks

CONTRIBUTING.md

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,48 @@
1-
# How to Contribute
1+
# Contributing to Capa Documentation
22

3-
We'd love to accept your patches and contributions to this project. There are
4-
just a few small guidelines you need to follow.
3+
Thank you for improving the Capa website and documentation. Contributions are reviewed through GitHub pull requests in [capa-cloud/capa.io](https://github.com/capa-cloud/capa.io).
54

6-
## Contributor License Agreement
5+
## Set up the site
76

8-
Contributions to this project must be accompanied by a Contributor License
9-
Agreement. You (or your employer) retain the copyright to your contribution;
10-
this simply gives us permission to use and redistribute your contributions as
11-
part of the project. Head over to <https://cla.developers.google.com/> to see
12-
your current agreements on file or to sign a new one.
7+
```bash
8+
git clone --recurse-submodules https://github.com/capa-cloud/capa.io.git
9+
cd capa.io
10+
npm ci
11+
npm --prefix themes/docsy install
12+
make dev
13+
```
1314

14-
You generally only need to submit a CLA once, so if you've already submitted one
15-
(even if it was for a different project), you probably don't need to do it
16-
again.
15+
Hugo Extended `0.145.0` is preferred. If it is not installed, `scripts/hugo.sh` uses the pinned Docker image.
1716

18-
## Code reviews
17+
## Make a documentation change
1918

20-
All submissions, including submissions by project members, require review. We
21-
use GitHub pull requests for this purpose. Consult
22-
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
23-
information on using pull requests.
19+
1. Create a branch from `master`.
20+
2. Edit the appropriate file under `content/zh/` or `content/en/`.
21+
3. Add the corresponding translation when the same workflow is available in both languages.
22+
4. Put unfinished pages behind `draft: true`; never publish Docsy template content.
23+
5. Use repository-relative links for files in this repository and canonical HTTPS links for external resources.
24+
6. Run `make check` before opening a pull request.
2425

25-
## Community Guidelines
26+
For website code or build changes, also run:
2627

27-
This project follows
28-
[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).
28+
```bash
29+
npm test
30+
make build
31+
```
32+
33+
## Pull request checklist
34+
35+
- The page explains what the reader can accomplish and includes prerequisites where needed.
36+
- Commands and dependency versions match the source repositories.
37+
- All links and images resolve.
38+
- Chinese and English navigation remain usable.
39+
- Examples contain no credentials, private endpoints, customer data, or personal identifiers.
40+
- Generated `docs/`, `public/`, and `resources/` files are not committed.
41+
42+
## Reporting problems
43+
44+
Use [GitHub Issues](https://github.com/capa-cloud/capa.io/issues) for broken pages, incorrect examples, translation gaps, and build failures. Security-sensitive reports should not include secrets or exploit data in a public issue.
45+
46+
## License
47+
48+
By contributing, you agree that your contribution is licensed under the repository's [Apache License 2.0](LICENSE).

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ deploy: check
3939

4040
# Check for broken links
4141
link-check:
42-
hugo server &
43-
sleep 3
44-
npx linkinator http://localhost:1313 --recurse --timeout 10000 || true
45-
pkill -f "hugo server"
42+
@./scripts/hugo.sh server --bind 127.0.0.1 --port 1313 >/tmp/capa-hugo.log 2>&1 & \
43+
pid=$$!; \
44+
trap 'kill $$pid 2>/dev/null || true' EXIT; \
45+
sleep 3; \
46+
npx --yes linkinator http://localhost:1313 --recurse --timeout 10000 \
47+
--skip '^https?://(?!(localhost|127\\.0\\.0\\.1):1313)'
4648

4749
# Show help
4850
help:
@@ -54,6 +56,6 @@ help:
5456
@echo " make build - Build production site (outputs to ignored docs/)"
5557
@echo " make check - Validate the production site without writing output"
5658
@echo " make clean - Remove build artifacts"
57-
@echo " make deploy - Build and deploy to GitHub Pages"
58-
@echo " make link-check - Check for broken links"
59+
@echo " make deploy - Validate and push master; CI builds and deploys Pages"
60+
@echo " make link-check - Crawl the local site and fail on broken links"
5961
@echo " make help - Show this help message"

0 commit comments

Comments
 (0)