Forms for Static Sites: Netlify, GitHub Pages, Astro & Hugo
Add a real, working form to any static site generator — Astro, Hugo, Eleventy, GitHub Pages — without a backend.
Static sites are fast, cheap, and easy to host — but the moment you need a contact or signup form, you hit a wall: there’s no backend to receive the submission. This guide shows the host-agnostic way to add a real, working form to any static site generator without standing up a server.
Why static sites need help with forms
When a visitor submits a form, the browser sends a POST request that something has to receive. On a static site there’s nothing listening — your pages are just files on a CDN. You have two options: add a serverless function yourself (more code, more to maintain), or point the form at a hosted endpoint that handles receipt, storage, email, and spam for you.
The universal snippet
Because every static generator ultimately outputs HTML, the same form works everywhere. Paste this into a page, template, or component:
<form action="https://saveform.io/api/submit/YOUR_FORM_ID" method="POST"> <input type="email" name="email" placeholder="you@example.com" required /> <textarea name="message" placeholder="Your message" required></textarea> <!-- Honeypot: hidden spam trap --> <input type="text" name="_honey" style="display:none" tabindex="-1" autocomplete="off" /> <button type="submit">Send</button> </form>
By static site generator
The integration is the same everywhere; only where you paste it differs.
- GitHub Pages / S3 / plain HTML: drop the snippet into your
.htmlfile. Done. - Hugo / Jekyll / Eleventy: add it to a layout or an include/partial so it’s reusable across pages.
- Astro: put it in a
.astrocomponent, or submit with fetch for an inline success message. See the Astro guide. - Gatsby / Next static export: use a React component with controlled inputs — see the React guide.
Progressive enhancement
Start with a plain HTML form so it works even if JavaScript fails to load. When you want a smoother experience — no full-page redirect — layer a fetch submission on top to show an inline thank-you and keep the visitor in place.
Where submissions go
Every submission is stored in your dashboard, emailed to you, and can be forwarded to a webhook — Slack, Discord, Zapier, or your own API. Need to filter bots first? Read how to stop form spam without CAPTCHA, or grab ready-made markup from the form code generator.
Frequently asked questions
Why can’t a static site handle form submissions?
A static site is just HTML, CSS, and JavaScript served as files — there’s no server-side code running to receive a POST, store it, or send an email. To process submissions you need something that runs on a server. A hosted form endpoint provides that without you operating any infrastructure.
How do I add a form to GitHub Pages?
GitHub Pages only serves static files, so point your form’s action at an external endpoint like SaveForm. Paste the form HTML into your page, swap in your form ID, and submissions are collected and emailed to you. No build step or server needed.
Do I have to use Netlify Forms on a Netlify site?
No. Netlify Forms only works when the site is hosted on Netlify and counts against their quota. A host-agnostic endpoint works the same whether you deploy to Netlify, Vercel, Cloudflare Pages, or GitHub Pages — and it moves with you if you switch hosts.
Will this work with Astro, Hugo, or Eleventy?
Yes. Static site generators output plain HTML, so the same form snippet works in Astro, Hugo, Eleventy, Jekyll, Gatsby, or hand-written HTML. In component frameworks you can also submit with fetch for an inline success state.
Related resources
Forms that move with your static site
One endpoint works across Astro, Hugo, Eleventy, GitHub Pages, and every host you might migrate to. Set it up once, free.