Last updated: 2026-02-19
This is the canonical, short "how we build sites" document meant to prevent:
- half-cooked themes,
- silent fallbacks,
- regressions across multiple websites,
- and agent guesswork.
This is compatible with both "standalone themes" and "themes that extend a vendored base theme".
- Always set
Featuresexplicitly insite.json. - Always use a theme manifest (
theme.manifest.jsonpreferred; legacytheme.jsonallowed). - Always run with two modes:
- dev: warn, summarize, stay fast
- ci/release: fail on new issues, enforce budgets
- For Linux-hosted static sites, follow
Docs\PowerForge.Web.LinuxDeployment.mdso hourly deploy checks are commit-driven and reusable across sites. - Always make the performance path explicit:
- add
optimizeto CI/release pipelines with explicitminifyHtml,minifyCss, andminifyJs - choose
assetRegistry.cssStrategyintentionally:blockingwhen the shell must never flash unstyled during hard navigations or reloadspreloadwhen critical CSS is solid and you want a softer non-blocking pathasynconly when the theme's critical CSS truly covers the first paint
- prefer
Head.Linksfor fonts/preconnects instead of hiding@importfont loads inside inline theme CSS - keep
{{ assets.preloads_html }}and{{ assets.css_html }}early in the head; PowerForge routesHead.Linkspreload/preconnect hints through the preload slot andrel=stylesheetlinks through the CSS slot so latehead_htmlplacement does not delay font/style discovery - when a site needs first-party copies of remote fonts/CSS, prefer
AssetPolicy.Rewriteswith HTTPSSourceUrl,SourceUrlAllowedHosts, andDownloadDependencies:true
- add
- Always keep escape hatches scoped:
- baselines for legacy noise
- do not blanket-ignore whole categories without a written reason
- Always prefer stable, engine-owned theme helpers over ad-hoc rendering:
- Scriban: use
pf.nav_links/pf.nav_actions/pf.menu_tree(avoidnavigation.menus[0]).
- Scriban: use
- Create/confirm these files exist at repo root:
site.jsonpipeline.jsonpipeline.maintenance.json.github/workflows/website-ci.yml.github/workflows/website-maintenance.ymlconfig/presets/pipeline.web-quality.jsonconfig/presets/pipeline.web-maintenance.json.powerforge/verify-baseline.json.powerforge/audit-baseline.json
site.json:- set
DefaultTheme
- set
- set
Featuresexplicitly (for example["docs","blog","news","apiDocs","search"]) - define navigation menus + actions
- define
Navigation.Surfacesexplicitly (canonical:main,docs,apidocs, optionalproducts;apiis treated as an alias ofapidocs) to keep docs/API navigation deterministic - configure quality gates:
- verify:
baseline,failOnNewWarnings - audit:
baseline,failOnNewIssues, budgets (maxTotalFiles, etc.)
- verify:
pipeline.json:- keep root
pipeline.jsonsmall and inherit shared defaults viaextends - put shared build/verify/audit/cache/profile defaults in
config/presets/pipeline.web-quality.json - for CI
audit/doctorsteps, lock compatibility-sensitive defaults:requireExplicitChecks: true- explicitly set:
checkSeoMetacheckNetworkHintscheckRenderBlockingResourcescheckHeadingOrdercheckLinkPurposeConsistencycheckMediaEmbedscheckAgentContentSecurity
- if your site depends on content/projects sourced from other repos, declare them under
Sourcesinsite.jsonand runsources-syncbeforebuild(or usepowerforge-web build --sync-sourceslocally) - run
build+verifyin all modes - run
sitemapafterbuildso XML/JSON sitemap artifacts stay in sync with generated routes - run
engine-lockverify in CI so missing/invalid.powerforge/engine-lock.jsonfails fast (preferrequireImmutableRef:true) - run heavy steps only in CI (
modes:["ci"]):audit(and rendered checks if enabled)optimizeindexnow(recommended withoptionalKey:trueso missing secrets skip safely in forks/dev)github-artifacts-prune(recommendeddryRun:true+optional:true; flip toapply:truein scheduled maintenance runs)
- keep audit media tuning in a reusable
./config/media-profiles.jsonfile and reference it viamediaProfilesonaudit/doctor
- keep root
- CI workflow:
- keep workflow YAML thin; normal binary consumers should usually pin only
powerforge_web_tag - keep
.powerforge/*for committed site policy and baselines, not workflow implementation logic - keep
.powerforge/engine-lock.jsoncommitted only when the site intentionally uses source mode (prefer immutable SHA inref) - default scaffolder workflow is a thin wrapper around
EvotecIT/PSPublishModule/.github/workflows/powerforge-website-ci.yml - default scaffolder maintenance workflow is a thin wrapper around
EvotecIT/PSPublishModule/.github/workflows/powerforge-website-maintenance.yml - reusable workflow resolves engine checkout from
POWERFORGE_LOCK_PATHor explicit repo/ref inputs - scaffolded workflow fails early when lock/override
refis not a full commit SHA (40/64 hex) - optional canary override: set GitHub vars
POWERFORGE_REPOSITORY/POWERFORGE_REFwithout editing lock file - upload
_reportsartifacts on every run (if: always()) to make regressions debuggable. - optional scheduled workflow: run
pipeline.maintenance.jsonweekly for storage hygiene (github-artifacts-prunewithapply:true+ safe caps) - scaffold maintenance caps intentionally with
powerforge-web scaffold --maintenance-profile conservative|balanced|aggressive(default:balanced)
- keep workflow YAML thin; normal binary consumers should usually pin only
- Theme manifest (
theme.manifest.jsonrecommended):- set
schemaVersion: 2 - declare
features - define
featureContractsfor drift-prone features:apiDocs: requiredapi-header/api-footer/theme-tokensand required CSS selectorsdocs: requireddocslayout and required slots/partials
- for Scriban editorial layouts (
blog/news), prefer{{ pf.editorial_cards ... }}+{{ pf.editorial_pager ... }}in list layouts so verify can detect regressions early pf.editorial_cardssupports variants (default,compact,hero,featured) plus optionalgrid_class/card_classoverrides so themes can evolve layout style without duplicating list rendering loops- if you define
featureContracts.blog/featureContracts.news, include selectors for the variants/override classes used bypf.editorial_cardsinrequiredCssSelectors
- set
- Layout hooks:
- layouts must include:
{{ assets.critical_css_html }}{{ include "theme-tokens" }}{{ extra_css_html }}{{ assets.css_html }}{{ assets.js_html }}{{ extra_scripts_html }}
- layouts must include:
- API docs rule:
- API pages must use the same global CSS as normal pages plus API-specific CSS.
- If the theme defines tokens, API docs must receive the same token partial/context as normal layouts so width, color, and spacing variables stay aligned.
- Use multi-css in apidocs:
"/css/app.css,/css/api.css". - If your site uses
Navigation.Profilesand you want API pages to select an/api/profile override for nav token injection, setnavContextPath: "/api/"on the apidocs pipeline step.
- Project examples rule:
- Treat examples as a curated project surface, not an automatic dump of every repo script.
- For public project hubs, prefer examples authored in:
Website/content/examplescontent/examples
- Only ingest raw
Examples/folders when the site explicitly wants fallback harvesting and the repo is known to be tidy enough for public display. - Keep
surfaces.examplesdisabled until a project has intentional example pages ready for the site. - After changing/removing public example routes, run a clean build or CI-mode pipeline before inspecting
_site; fast incremental builds may keep stale generated pages. - If examples are enabled, verify the generated routes and the project metadata (
project_surface_examples,project_link_examples,project_local_examples_available) after sync.
If a site publishes APIs for multiple related projects or modules, prefer one engine-owned suite portal over several disconnected API roots.
PowerForge now scaffolds this shape directly:
powerforge-web scaffold --out .\Website --engine scriban --starter-profile multi-project-api-suiteTo promote the starter into a real first project immediately:
powerforge-web scaffold --out .\Website --engine scriban --starter-profile multi-project-api-suite --suite-project-slug samplemodule --suite-project-name "Sample Module" --suite-project-surface powershellThat seeded project also gets source staging that matches project-apidocs discovery:
- PowerShell seed:
projects-sources/<slug>/powershell/plusexamples/ - .NET seed:
projects-sources/<slug>/dotnet/
To avoid false-positive discovery, scaffolded starter files live under templates/ and use non-discoverable names until you replace them with real inputs.
The scaffold also adds promotion helpers inside the seeded source folder:
- PowerShell:
promote-from-templates.ps1 - .NET:
promote-from-build.ps1
That starter creates:
data/projects/catalog.jsondata/projects/catalog.project-template.jsondata/projects/api-suite-narrative.jsondata/projects/sample-project-api-guides.jsoncontent/docs/projects/api-guide-template.mdprojects-sources/README.mdthemes/<theme>/partials/api-header.htmlthemes/<theme>/partials/api-footer.htmlthemes/<theme>/assets/api.css- a placeholder
/projects/api-suite/page thatproject-apidocscan replace once real APIs are generated
Starter adoption note:
project-apidocsnow emits[PFWEB.APIDOCS.SUITE]recommendations when the suite scaffold is still untouched or when sample placeholders likesample-project/sample-project-api-guides.jsonleak into the real catalog.
Recommended contract:
- In
pipeline.json, useproject-apidocs. - Add
suiteTitle. - Add
suiteNarrativeManifest(orsuiteNarrativeManifests) so the generatedapi-suite/portal has aStart Heresection. - In project catalog entries, add
apiDocs.quickStartTypesfor the main entry points of each project. - In project catalog entries, add
apiDocs.relatedContentManifest/relatedContentManifestsso curated guides/samples can be attached per project. - In CI, add:
suiteCoverage+suiteFailOnCoveragesuiteNarrative+suiteFailOnNarrative
Minimal pipeline example:
{
"steps": [
{
"task": "project-apidocs",
"catalog": "./data/projects/catalog.json",
"sourcesRoot": "./projects-sources",
"outRoot": "./_site/projects",
"template": "docs",
"format": "both",
"suiteTitle": "Project APIs",
"suiteNarrativeManifest": "./data/projects/api-suite-narrative.json",
"suiteCoverage": {
"minQuickStartRelatedContentPercent": 80,
"maxQuickStartMissingRelatedContentCount": 1
},
"suiteFailOnCoverage": true,
"suiteNarrative": {
"requireSummary": true,
"minSectionCount": 1,
"minSuiteEntryCoveragePercent": 100
},
"suiteFailOnNarrative": true
}
]
}Minimal catalog example:
{
"projects": [
{
"slug": "samplemodule",
"name": "Sample Module",
"hubPath": "/projects/samplemodule/",
"surfaces": {
"apiPowerShell": true
},
"apiDocs": {
"quickStartTypes": "Invoke-SampleAction",
"relatedContentManifest": "./data/projects/samplemodule-api-guides.json"
}
}
]
}Minimal suite narrative example:
{
"summary": "Use this suite portal to choose the right API and follow the main onboarding flow.",
"sections": [
{
"title": "Start Here",
"summary": "Begin with the primary automation project, then move into supporting APIs.",
"items": [
{
"title": "Open the Sample Module quick start",
"url": "/projects/samplemodule/docs/quick-start/",
"kind": "workflow",
"audience": "New maintainers",
"estimatedTime": "10 min",
"projects": [ "samplemodule" ]
}
]
}
]
}If your site needs content/projects from other repositories (public or private), declare them in site.json under Sources and sync them as part of your build.
Best practices:
- Prefer
TokenEnv(defaults toGITHUB_TOKEN) over inlineTokenfor private repos. - In CI, use a lock file:
lockMode: "verify"and commit.powerforge/git-sync-lock.json. - In dev, you can refresh locks intentionally with
lockMode: "update". - Prefer repo-relative
Destinationvalues so committedgit-sync-lock.jsonentries stay portable across machines and CI runners. Absolute destinations make the lock file machine-specific. - To migrate older absolute-path locks, run one intentional
lockMode: "update"pass after switching the source config to repo-relative destinations. - Keep
builddeterministic:- Use
sources-sync(orbuild --sync-sources) explicitly, rather than auto-downloading inside normal builds.
- Use
How destinations work:
- If
Destinationis omitted, PowerForge.Web clones each repo to:<ProjectsRoot>/<Slug>(or./projects/<Slug>whenProjectsRootis not set).
- If
Slugis omitted, it is inferred from the repo URL/name. - If you need a different folder layout, set
Destination.
Example site.json snippet:
{
"ProjectsRoot": "projects",
"Sources": [
{
"Repo": "ExampleOrg/ExampleDocs",
"Slug": "exampledocs",
"Ref": "main",
"AuthType": "token",
"TokenEnv": "GITHUB_TOKEN"
}
]
}Dev bootstrap (refresh lock intentionally):
powerforge-web sources-sync --config ./site.json --lock-mode update --lock-path ./.powerforge/git-sync-lock.jsonExample pipeline.json snippet:
{
"extends": "./config/presets/pipeline.web-quality.json",
"steps": [
{
"task": "sources-sync",
"config": "./site.json",
"lockMode": "verify",
"lockPath": "./.powerforge/git-sync-lock.json"
}
]
}If your site is behind Cloudflare and caches HTML, consider purging key HTML URLs after deploy (or keeping HTML TTL low). PowerForge.Web provides a small purge command:
Docs/PowerForge.Web.Cloudflare.md
Recommended deploy pattern:
- purge:
powerforge-web cloudflare purge --zone-id <ZONE_ID> --token-env CLOUDFLARE_API_TOKEN --site-config ./site.json
- verify:
powerforge-web cloudflare verify --site-config ./site.json --warmup 1
Prefer --site-config over hardcoded route lists so route coverage stays aligned with
Features and Navigation as the site evolves.
The reusable powerforge-website-deploy.yml queues Pages publication per repository. Site builds can still run in parallel, and a failed publication can still retry its staged artifact.
Set skip_superseded_pages_deployments: true to skip an automatic branch build when a descendant has already been published. The publisher verifies that the previous deployment was built from its event commit before comparing commits. A manual publish of the branch head can supersede an older automatic build. Manual runs, tag runs and explicit alternate build revisions can still publish. Callers with their own post-publish jobs can check needs.<job>.outputs.pages_deployed == 'true' before using the new deployment.
Let existing Pages publishers finish before updating the workflow pin. GitHub can rerun older jobs with their original pin, so those jobs may publish independently of the new queue.
Upgrade pinned engine ref intentionally:
powerforge-web engine-lock --mode update --path .\.powerforge\engine-lock.json --ref <new-sha> --channel stableVerify lock drift (for local checks/scripts):
powerforge-web engine-lock --mode verify --path .\.powerforge\engine-lock.json --ref <expected-sha> --require-immutable-refIf a theme declares extends, the base theme must be present on disk (vendored into the repo).
powerforge-web verify warns when extends points to a missing base folder to avoid silent fallback.
Recommendation:
- Treat
extendsas a repo-local dependency (vendor base theme underthemes/<base>). - Prefer a stable CSS variable namespace (
--pf-*) rather than coupling variables to a base theme name.
In AGENTS.md (site repo):
- repo purpose + build commands
- list of enabled
Features - theme structure + whether it uses
extends - where API docs config lives (apidocs steps + css list)
- where baselines/budgets live and how to update them