Contact form for Hugo
Add a contact form to your Hugo site with a reusable shortcode. No server and no JavaScript needed, and every message reaches your email, Telegram or Slack.
Why a form backend for Hugo
Hugo builds plain HTML files in milliseconds, and that's the point: no server, no database, nothing to patch. A contact form is the one piece of a typical site that needs something to receive the data.
Lazyform is that something. Your form posts to our endpoint, we check it for spam and deliver it, and your Hugo site stays a folder of static files.
A working contact form
First, add your key to the site config and make sure baseURL is your real domain. Replace YOUR_ACCESS_KEY with your key from /login.
baseURL = "https://example.com/"
[params]
lazyform_key = "YOUR_ACCESS_KEY"Then create a shortcode:
<form action="https://lazyform-api.xvelopers.com/submit" method="POST" class="contact-form">
<input type="hidden" name="access_key" value="{{ site.Params.lazyform_key }}">
<input type="hidden" name="redirect" value="{{ "thanks/" | absURL }}">
<input type="hidden" name="subject" value="New message from {{ site.Title }}">
<label for="name">Name</label>
<input id="name" name="name" required>
<label for="email">Email</label>
<input id="email" name="email" type="email" required>
<label for="message">Message</label>
<textarea id="message" name="message" rows="6" required></textarea>
<input type="checkbox" name="botcheck" class="hidden" style="display:none">
<button type="submit">Send</button>
</form>Use it in any content file, for example content/contact.md:
---
title: Contact
---
Questions? Send us a message.
{{< contact-form >}}Create content/thanks.md for the page visitors land on after sending.
Get submissions where you want them
Submissions arrive by email. You can also get Telegram, Slack, Discord or WhatsApp alerts, or add each one as a row in Google Sheets. See all integrations.
Full guide
The Hugo guide covers shortcode parameters, sending without a page reload, file uploads and spam protection.
Questions
Do I have to edit my theme?
No. Shortcodes in your site's own layouts/shortcodes folder are picked up by Hugo whatever theme you use, so the theme stays untouched.
Why put the key in the site config?
So it lives in one place. If you have several forms or change the key later, you only update hugo.toml. The key is public by design and cannot read submissions.
Can I have different forms on different pages?
Yes. Make another shortcode, or pass the key or subject as shortcode parameters. Each form in Lazyform has its own key and its own settings.
Will it work on GitHub Pages or Netlify?
Yes. Hugo outputs static files and the form posts straight to Lazyform, so any static host works.