custom-mygrid

Website development and publishing

The hub uses Astro to build a static landing page and documentation with the existing green and cream design. It needs no server runtime, client framework, remote fonts or analytics. There are no JavaScript interactions to carry over: section links, scrollable tables and native disclosure controls work without JS.

Local development

From the repository root, use Node 24.14.0 (nvm use) and pnpm 12.16.1. Astro and the Markdown processor are pinned in package.json; commit changes to pnpm-lock.yaml together with dependency changes. CI explicitly installs the pinned pnpm version before running pnpm install --frozen-lockfile.

npm install --global pnpm@12.16.1
pnpm install --frozen-lockfile
pnpm run dev

Open http://127.0.0.1:4321/custom-mygrid/. Markdown, layout and CSS edits refresh in development. After adding assets, restart the command to copy them again. To inspect exactly what will be published:

pnpm test
pnpm run build
pnpm run check:site
pnpm run preview

Preview uses the same URL and repository prefix. pnpm test runs focused routing tests and works immediately after pnpm install --frozen-lockfile, without a prior build. After pnpm run build, pnpm run check:site validates all output pages, internal links, fragments, local assets and legacy redirect targets, and that every shared page carries its canonical URL, Open Graph image and description. The old python3 scripts/build-site.py entry point now delegates to the Astro build; install dependencies first.

Project structure

docs/README.md renders at /custom-mygrid/docs/; other docs/*.md files render at /custom-mygrid/docs/<filename>/. The route discovers all Markdown in that directory automatically. Add every new page to the documentation navigation in site/lib/nav.mjs; pnpm test fails when a published page is missing. This contributor guide renders at docs/website/.

Astro’s Unified Markdown processor supplies GitHub-flavored tables, fenced code highlighting and heading IDs. A Remark transform resolves relative links from the source file’s directory, maps Markdown destinations to published routes, and preserves query strings and anchors. Markdown links and reference definitions share the same transform. Relative images under assets/ or docs/assets/ are served from those paths within the prefix. Put documentation images in docs/assets/ and reference them as assets/example.png; use Markdown image syntax so the transform sees them. Links to other repository files use GitHub. External URLs, mail links and fragment-only links are left intact. Keep raw HTML URLs prefix-aware yourself; they do not pass through the Markdown URL transform.

Existing landing page section IDs and documentation heading IDs remain usable. Astro generates static refresh pages for legacy docs/*.md paths and site/README.md, since GitHub Pages cannot issue HTTP redirects. Existing GitHub URLs remain valid source links. Guide links on the landing page now open the hub.

Repository prefix

site/astro.config.mjs sets site: 'https://tjorim.github.io', static output and trailing slashes. site/lib/paths.mjs defines /custom-mygrid/ once; layouts, landing page links, Markdown transforms and compatibility routes all use it. Astro prefixes its generated CSS assets. Do not add a second prefix manually. For another repository, change the site origin, base and repository URL, then run the production build and link checker under that prefix before publishing.

CI and deployment

In GitHub Settings → Pages, choose GitHub Actions as the source. The Website workflow installs the pinned Node and pnpm toolchain, runs pnpm install --frozen-lockfile, builds all pages and validates output for both pull requests and pushes to main. Its path filters include Markdown, site sources, assets, build scripts, dependency manifests and the Node pin. It uploads _site/ with upload-pages-artifact and uses the existing Pages deploy job only on main. Manual runs on main can redeploy; manual runs on other branches build and test without publishing. Expected public URL: https://tjorim.github.io/custom-mygrid/.

This layout is reusable without a shared package or identical branding: preserve each project’s Markdown locations, derive routes from them, share one page shell, centralize the base path, pin dependencies, and verify the prefixed build in PR CI. Search is deferred: six documentation pages are readily reachable through the navigation and per-page contents list.

Upstream documentation ownership

This website publishes complete integration and library guides inside its shared navigation. Maintain HA setup, entities, automations and troubleshooting in the integration repositories; maintain Python usage, protocol details and library validation in the library repositories. Keep cross-device introductions and project architecture here. Link to detailed guides instead of repeating them.

upstream/sources.json maps authoritative files to stable website routes and pins each repository to a full commit SHA. upstream/ contains exact, checked-in snapshots, not independently maintained copies. Updates stage all snapshots and the manifest together before replacing the live directory. A promotion failure restores the old set; if restoration fails too, the error reports a preserved backup directory for manual recovery. Do not edit those Markdown files: edit their upstream source, then run pnpm docs:update. Build-time SHA-256 checks reject accidental snapshot edits. Normal builds require no upstream network access.

The weekly Update upstream documentation workflow (also manually runnable) refreshes pins and snapshots and validates the site in a read-only job with checkout credentials disabled. A separate publishing job downloads the validated snapshot artifact and opens or updates one PR; dependency installation and site processing never run with the write token. Enable Allow GitHub Actions to create and approve pull requests in repository Actions settings for automatic PR creation. Review that PR before merging; no upstream changes are published automatically. If validation fails, no update PR is pushed. Run the same commands locally when adding a source:

pnpm docs:update
pnpm test
pnpm run build
pnpm run check:site

Imported pages show their upstream revision and link to the pinned source and upstream editing branch. Relative Markdown links to other imported pages stay on the website; other files link to the pinned upstream commit. Relative images use commit-pinned raw GitHub URLs; external badges retain their original URLs. Existing ModuleTwo and VoltBridge setup URLs are preserved. Their local docs/ files are pointers for GitHub readers and are replaced by upstream content when rendering the website. The VoltBridge API reference is imported from the Python library at the existing docs/voltbridge-api/ URL. Integration READMEs remain complete setup guides for GitHub and Marketplace. Marketplace exclusion comments hide only installation and contributor sections there; the website renders the full guide.