FormThunder isn't open yet. This site describes the service as it will run at launch. Find out more

FormThunder
Menu

Add a Hugo contact form with a partial and a shortcode

A Hugo site can have a working contact form while staying fully static. Keep the access key in your site params, put the form in a partial, and add a shortcode so authors can drop it into any Markdown page. The form posts to FormThunder, which stores each submission and emails you.

Updated

The Hugo code

hugo.toml
[params]
  formthunderKey = "YOUR_ACCESS_KEY"
layouts/partials/contact-form.html
<form action="https://formthunder.com/submit" method="POST">
  <input type="hidden" name="access_key" value="{{ site.Params.formthunderKey }}">
  <input type="hidden" name="redirect" value="{{ "thanks/" | absURL }}">
  <input type="checkbox" name="botcheck" style="display:none" tabindex="-1">
  <label>Name <input name="name" required></label>
  <label>Email <input name="email" type="email" required></label>
  <label>Message <textarea name="message" required></textarea></label>
  <button type="submit">Send</button>
</form>
layouts/shortcodes/contact.html
{{ partial "contact-form.html" . }}
content/contact.md
---
title: Contact
---

Tell us what you're working on.

{{< contact >}}

Replace YOUR_ACCESS_KEY with your free key. It's public by design, so it's safe in client code.

Notes for Hugo

  • Hugo strips raw HTML from Markdown by default (markup.goldmark.renderer.unsafe = false), which is why you need a shortcode rather than pasting the form into the page.
  • absURL builds the redirect from baseURL. On a local hugo server it points at localhost, so form posts return you to your dev site.
  • Create content/thanks.md for the redirect target, with sitemap: { disable: true } in its front matter to keep it out of your sitemap.

Or have your AI add it

Connect the MCP server, then ask. The agent creates the form and writes the code for you, and it can send a real test when it's done.

You, to your AI
Add a FormThunder contact form to this Hugo site that emails hello@example.com. Send a test when you're done.

Questions

Does Hugo have a built-in contact form?

No. Hugo generates static files, so a form needs an outside service to receive the POST.

Can themes include this?

Yes. Put the partial in the theme's layouts/partials folder and keep the key in each site's params.

Get your Hugo form sending

The free plan covers 250 submissions a month, with MCP, the CLI and the brand kit included.