G
GTM Vault
Browse
  • Dashboard
    • Automations
    • Skills
    • Prompts
    • Makers
  • Sign in
All Skills

netlify-deploy

Reference for Netlify deployment — netlify.toml structure, redirect rules, static site config, functions

skillInfrastructureClaude Code SkillsInternal Ops
Original
by Roheel Jain
Skill Content

Static Site Config

For static HTML sites with no build step:

[build]
  publish = "."
  • No build command needed
  • Publish directory is . (root)
  • Deploys take ~4-5 seconds

netlify.toml Redirect Rules

# Rules are processed top-to-bottom, first match wins

# Passthrough rules first (public pages)
[[redirects]]
  from = "/public-page.html"
  to = "/public-page.html"
  status = 200

# Role-gated rules (conditions)
[[redirects]]
  from = "/*"
  to = "/protected.html"
  status = 200
  force = true
  conditions = {Role = ["rolename"]}

# Fallback redirects last
[[redirects]]
  from = "/*"
  to = "/login.html"
  status = 302
  force = true

Key rules:

  • force = true overrides even when a physical file exists at the path
  • Without force, redirects only apply when no file exists
  • status = 200 serves the target (rewrite), status = 302 redirects the browser
  • conditions = {Role = ["viewer"]} checks JWT roles

Netlify Functions

  • Place in netlify/functions/ directory
  • Auto-deployed, accessible at /.netlify/functions/<filename>
  • Identity event functions use special names: identity-signup, identity-validate, identity-login

Deploy Verification

  • Check deploy status in Netlify dashboard → Deploys tab
  • Filter deploys by branch name in search box
  • "Published" badge shows which deploy is live
  • "Trigger deploy → Deploy site" for manual deploys

Common Error

Always verify which branch Netlify is deploying from before pushing. If production branch is set to a feature branch, pushing to main won't trigger a deploy.

Tech Stack
JavaScript
JavaScript