How to Connect Hugo Forms to Form2Lead
Step-by-step developer instructions for Hugo applications.
How do you send Hugo form submissions to Form2Lead?
Add a working contact form to any Hugo site by pointing a form partial at a Form2Lead endpoint — no server, no shortcode plugin, no third-party embed.
Why use Form2Lead with Hugo?
Hugo builds fast static sites, but static output cannot receive form POSTs. Form2Lead is the cloud backend: create a shortcode or partial with a plain HTML form, set the action to your Form2Lead URL, and submissions are validated, spam-filtered, emailed to you, and stored in a dashboard. Your `hugo build` stays 100% static and deploys anywhere — Netlify, Cloudflare Pages, or GitHub Pages.
Prerequisites
- ✔A Hugo site
- ✔A Form2Lead endpoint URL
Step-by-Step Integration Guide
01. Create a Form Partial
Add `layouts/partials/contact-form.html` with a plain HTML form pointed at your Form2Lead endpoint.
<form action="https://form2lead.com/api/v1/f/YOUR_FORM_ID" method="POST"> <input type="text" name="name" placeholder="Your Name" required /> <input type="email" name="email" placeholder="Your Email" required /> <textarea name="message" placeholder="Your Message" required></textarea> <input type="text" name="_gotcha" style="display:none !important" tabindex="-1" autocomplete="off" /> <button type="submit">Send Message</button> </form>
02. Include the Partial in a Page
Render the form inside any content page with the partial include.
{{ partial "contact-form.html" . }}03. Add Your Deployed Origin to Allowed Domains
In Form2Lead form settings, add your Hugo site origin (for example `mysite.netlify.app` or your custom domain) so only your pages can submit.
Hugo Integration FAQ
Does Form2Lead work with Hugo’s static output?
Yes. The form is plain HTML — `hugo` never needs a server runtime. Form2Lead receives the POST directly from the browser.
Can I use Form2Lead with Hugo modules or themes?
Yes. Drop the partial into any theme that renders custom layout files, or inline the form markup in a single page template.