|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Repository purpose |
| 6 | + |
| 7 | +This repo holds the [spine.io](https://spine.io) site. It is published to GitHub Pages via the |
| 8 | +`gh-pages.yml` workflow on every push to `master` or `staging`. |
| 9 | + |
| 10 | +The repo is "two-headed": |
| 11 | +- A **Hugo** site rooted in `site/`. |
| 12 | +- A thin **Gradle** wrapper at the root, which only exists to expose Hugo/Lychee commands as |
| 13 | + Gradle tasks (and to participate in the larger Spine composite build via `buildAll`). |
| 14 | + |
| 15 | +There is no application code here other than Hugo templates and a small amount of JS/SCSS under |
| 16 | +`site/assets/`. |
| 17 | + |
| 18 | +## Common commands |
| 19 | + |
| 20 | +Run these from the repo root unless noted. |
| 21 | + |
| 22 | +| Task | Command | |
| 23 | +|---|---| |
| 24 | +| Run site locally (Hugo dev server on `:1313`) | `./gradlew :runSite` or `cd site && hugo server` | |
| 25 | +| Build the site (no server) | `./gradlew :buildSite` or `cd site && hugo` | |
| 26 | +| Check broken links (Lychee) | `./gradlew :checkLinks` — requires the dev server running on `:1313` | |
| 27 | +| Install Node deps (PostCSS pipeline) | `cd site && npm install` | |
| 28 | +| Update documentation module | `cd site && hugo mod get -u github.com/SpineEventEngine/documentation/docs` | |
| 29 | +| Update site-commons theme | `cd site && hugo mod get -u github.com/SpineEventEngine/site-commons` | |
| 30 | +| Update all Hugo modules | `cd site && hugo mod get -u ./...` | |
| 31 | +| Clear Hugo module cache (on module errors) | `cd site && hugo mod clean --all` | |
| 32 | + |
| 33 | +Prerequisites: JDK 8 (x86_64), Go 1.12+, Node 18+, Hugo Extended **v0.150.0 or higher**. |
| 34 | + |
| 35 | +The `_script/hugo-serve`, `_script/hugo-build`, and `_script/proof-links` shell scripts are what |
| 36 | +the Gradle tasks invoke. They `cd site` and source `~/.bash_profile`/`~/.bashrc` so Gradle's |
| 37 | +non-interactive shell still sees the user's Hugo/Go install. |
| 38 | + |
| 39 | +## Architecture |
| 40 | + |
| 41 | +### Hugo modules: where the content actually lives |
| 42 | + |
| 43 | +Most of the site's content is **not in this repo**. `site/config/_default/hugo.toml` imports two |
| 44 | +Hugo modules (pinned in `site/go.mod`): |
| 45 | + |
| 46 | +- `github.com/SpineEventEngine/documentation/docs` — all `/docs/...` pages. Edit there, not here. |
| 47 | +- `github.com/SpineEventEngine/site-commons` — shared theme: partials, shortcodes |
| 48 | + (`cloakemail`, `note-block`, code blocks, anchor icons, snackbars), email data, repository data. |
| 49 | + |
| 50 | +When something on the rendered site (especially under `/docs`) isn't where you expect, check |
| 51 | +those two upstream repos before searching this one. The `AUTHORING.md` and the site-commons |
| 52 | +`_reference/` directory document the available shortcodes. |
| 53 | + |
| 54 | +The documentation side-navigation lives in the `documentation` repo at |
| 55 | +`docs/data/docs/<version_id>/sidenav.yml` (or per-module). Prev/Next buttons are generated from it. |
| 56 | + |
| 57 | +### Code samples |
| 58 | + |
| 59 | +`_code/examples/` contains **git submodules** pointing to `spine-examples/*` repos (hello, airport, |
| 60 | +blog, kanban, todo-list). The `embed-code` tool referenced in `README.md` / `_code/EMBEDDING.md` |
| 61 | +is **not used in this repo** — it only runs in the `documentation` repo. Don't try to wire it up |
| 62 | +here. |
| 63 | + |
| 64 | +### Local content in this repo |
| 65 | + |
| 66 | +`site/content/` holds the pages that are *not* documentation: |
| 67 | +landing (`_index.md`, `hero.json`, `features.json`, `step-*.md`), `about`, `blog`, |
| 68 | +`getting-help` (with `services.json` / `support-section.json`), `checkout` / `checkout-completed`, |
| 69 | +`faq`, `oss-licenses`, `privacy`, `release-notes`. |
| 70 | + |
| 71 | +`site/layouts/` overrides theme templates for these sections plus `_default`, `_partials`, |
| 72 | +`_shortcodes`, and `index.html`. Main navigation data is in `site/data/navbar.yml`; the layout |
| 73 | +template is `site/layouts/_partials/components/navbar/navigation.html`. |
| 74 | + |
| 75 | +### Payments / checkout |
| 76 | + |
| 77 | +The `getting-help` page sells products and uses a real (staging in dev) payment flow. Config in |
| 78 | +`site/config/_default/hugo.toml` under `[params.payment]` points the dev environment at the |
| 79 | +staging Paygate. Test cards: LHV sandbox (see `README.md`). Do not change `paygateURL` / |
| 80 | +`consentURL` casually — they are environment-aware. |
| 81 | + |
| 82 | +### Markdown is rendered with `unsafe = true` |
| 83 | + |
| 84 | +Hugo's Goldmark is configured with `unsafe = true` and block attributes enabled |
| 85 | +(`site/config/_default/hugo.toml`), so raw HTML inside Markdown is allowed and `{.class}` |
| 86 | +attribute syntax works. This is intentional — many pages embed HTML directly. |
| 87 | + |
| 88 | +## Authoring conventions (from AUTHORING.md) |
| 89 | + |
| 90 | +These are enforced by reviewers and by the Lychee link check; follow them: |
| 91 | + |
| 92 | +- **Internal links must not start with `/`.** Use `docs/introduction/`, not `/docs/introduction/`. |
| 93 | +- **Internal links must end with `/`** to avoid redirect hops. |
| 94 | +- For URLs that depend on the current docs version or external repos, use the variable forms: |
| 95 | + `{{% version %}}` and `{{% get-site-data "repositories.<key>" %}}` (key resolves against |
| 96 | + `site-commons/data/repositories.yml`). |
| 97 | +- In layout partials (HTML), build URLs via Hugo: `{{ \`docs/...\` | relURL }}`. |
| 98 | +- Image size hints: append `#medium` or `#small` to the image path. |
| 99 | +- Use the `cloakemail` shortcode for any email/phone — never inline them. |
| 100 | + |
| 101 | +Lychee excludes live in `lychee.toml`. The GitHub Actions check is `.github/workflows/proof-links.yml`. |
| 102 | + |
| 103 | +## When updating Hugo modules |
| 104 | + |
| 105 | +After `hugo mod get -u ...`, commit both `site/go.mod` and `site/go.sum`. The convention is to |
| 106 | +**prune `go.sum` down to the two required entries per module** so the file doesn't accumulate |
| 107 | +old versions. |
0 commit comments