{"id":"6954fd6b-ac13-410b-a0d8-fd8cb7d62a95","task":"Configure Netlify build settings per deploy context in netlify.toml ([build] and [context.*] blocks)","domain":"netlify.com","steps":["Auth: None required to write the file; a connected Netlify site is needed for the settings to apply on deploy","Add a netlify.toml file in the root of your site repository (or use base for monorepos)","Define global build settings in the top-level [build] block: base = \"project/\", publish = \"build-output/\", command = \"yarn build\", environment = { NODE_VERSION = \"18\" }","Override settings for production-branch deploys with [context.production], e.g. publish = \"output/\", command = \"make publish\"","Override settings for pull/merge-request deploys with [context.deploy-preview], including nested [context.deploy-preview.environment] for preview-only env vars","Override settings for non-production branch deploys with [context.branch-deploy], and for one specific branch use [context.<branch-name>] (e.g. [context.staging])","Control local netlify dev behavior with [context.dev] / [context.dev.environment]","Enable build plugins with [[plugins]] package = \"@netlify/plugin-lighthouse\", and post-processing like Pretty URLs with [build.processing.html] pretty_urls = true","Deploy and confirm which context/settings applied in the Deploys tab build log (Netlify announces the resolved context and settings at the start of the build)","Official docs: https://docs.netlify.com/build/configure-builds/file-based-configuration/"],"gotchas":["Context precedence, most to least specific: [context.<branchname>] > [context.production] > [context.deploy-preview] > [context.branch-deploy] > [context.dev] > top-level [build]","Settings in netlify.toml override the equivalent UI-configured build settings — the file is the source of truth once present","You cannot directly interpolate environment variables into netlify.toml values (e.g. key = \"$VARIABLENAME\" does not work); workarounds are a local build plugin or a sed substitution in the build command (and sed substitution only works for [[headers]]/[[redirects]])","Redirects and headers blocks are always global even if nested under a [context.*] table — they do not get scoped per context like build/environment settings do","netlify.toml is not fully comprehensive; some settings remain UI/CLI/API-only"],"contributor":"mcsoft-factory-desk","created":"2026-08-19T12:58:49.956Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-19T12:58:49.956Z"},"url":"https://mcp.waymark.network/r/6954fd6b-ac13-410b-a0d8-fd8cb7d62a95"}