Falkenstein, Germany · Hetzner Online GmbH
FormHaven

A Jekyll contact form that works on GitHub Pages

Jekyll turns your site into plain files, so nothing on it can send an email. Save one include that posts to FormHaven and every message reaches your inbox, spam filtered and stored in the EU, with no gem to add to your Gemfile.

14 days free, no card. Paste the address where the code says YOUR_FORM_ID.

_includes/contact-form.html
<form action="https://formhaven.net/f/YOUR_FORM_ID" method="POST">
  <label>Your name <input type="text" name="name" required></label>
  <label>Your email <input type="email" name="email" required></label>
  <label>Message <textarea name="message" required></textarea></label>
  <input type="text" name="_gotcha" style="display:none" tabindex="-1" autocomplete="off">
  <input type="hidden" name="_next" value="{{ '/thanks/' | relative_url }}">
  <button type="submit">Send message</button>
</form>

Set it up

  1. 1

    Create a form in FormHaven

    Sign up, press New form and copy its address. It looks like https://formhaven.net/f/YOUR_FORM_ID.

  2. 2

    Save the include

    Save the code above as _includes/contact-form.html with your own address in the action. Jekyll keeps folders that start with an underscore out of the built site, so only pages that include it show the form.

  3. 3

    Put it on your contact page

    Write {% include contact-form.html %} in contact.md or in a layout. The page needs front matter, even two lines of --- with nothing between them, or Jekyll leaves the tag as text.

  4. 4

    Add a thank-you page and test

    Create thanks.md with permalink: /thanks/ in its front matter. Run bundle exec jekyll serve, open http://localhost:4000, send the form and check your inbox.

A different subject line per page

Jekyll passes parameters to an include, so one file can serve your contact page and your quote page. Add a hidden _subject field that reads include.subject, and the default filter fills in a subject when a page passes none. Sort your inbox by it.

_includes/contact-form.html
<input type="hidden" name="_subject"
  value="{{ include.subject | default: 'New message from the website' }}">

<!-- on quote.md -->
{% include contact-form.html subject="Quote request" %}

On a GitHub Pages project site

A project site lives at USERNAME.github.io/REPOSITORY, so a bare /thanks/ opens on the wrong address. Set baseurl once: relative_url in the include puts it in front of /thanks/. When the site moves to your own domain, empty baseurl and the include stays as it is. FormHaven only follows _next to the site the form was sent from.

_config.yml
url: "https://USERNAME.github.io"
baseurl: "/REPOSITORY"

Stop bots that skip the hidden field

Turn on the bot check in the form's settings and add this line under the form in the include, so every page that shows the form loads it. Visitors see nothing, and it sets no cookies.

_includes/contact-form.html
<script src="https://formhaven.net/bot-check.js" async></script>

Questions about this setup

Does this work on GitHub Pages without a plugin?
Yes. The include is HTML plus two filters every Jekyll site has, relative_url and default, so GitHub Pages builds it like any other page. Nothing runs on GitHub when a visitor presses Send: the browser posts straight to FormHaven.
Why does my page show the include tag as text?
The file has no front matter. Jekyll only runs Liquid in files that start with a front matter block, so add two lines of --- at the top, even with nothing between them.
Can I put the form in a blog post?
Yes. Posts run Liquid too, so {% include contact-form.html %} works in a file in _posts as it does on a page.
How do I answer a message?
Press Reply in the email. The address the visitor typed in the email field is set as the reply address.
Can my client get the messages instead of me?
Yes. Add up to 5 more addresses to the form. Each one confirms by a link first, and their copy carries no FormHaven branding. You can turn your own copy off.

More to read

GitHub Pages contact formHosting the Jekyll site on github.io Astro contact formA Contact.astro component for a static Astro site HTML form to emailOne line in the action, every message in your inbox Static site contact formOne form for Astro, Hugo, Eleventy, Jekyll or plain HTML Hugo contact formA partial and a shortcode for a static Hugo site Lovable contact formOne prompt for a site built with Lovable GDPR compliant contact formEU storage, a DPA and retention you set Kontaktformular nach DSGVOAuf Deutsch: gespeichert in Deutschland, mit AVV JavaScript contact formA fetch script that keeps the visitor on the page Vercel contact formFor plain HTML, Astro or Next.js hosted on Vercel FormSubmit not workingThe usual causes of a silent FormSubmit form Web3Forms not workingThe usual causes of a silent Web3Forms form Eleventy contact formAn include for a static Eleventy (11ty) site Formspree not workingThe usual causes of a silent Formspree form Export from FormspreeEvery Formspree submission, as a file Export from FormsparkEvery Formspark submission, as a file EmailJS not workingThe usual causes of a silent EmailJS form Form backend for AI agentsThe start request, every REST route and MCP tool Claude Code contact formOne prompt, then press Activate Cursor contact formThe prompt and the .cursor/mcp.json entry Contact form privacy policyThe paragraph to copy, in 8 languages Cloudflare Pages contact formFor sites on pages.dev or your own domain Netlify contact formFor sites on netlify.app or your own domain React contact formOne component for Vite and other React apps Next.js contact formA client component that works with output: export Send form submissions to multiple emailsUp to 5 confirmed addresses per form, plus yours SvelteKit contact formOne Svelte 5 component, any adapter Nuxt contact formOne Vue component for Nuxt 4 and 3 Gatsby contact formOne component for a Gatsby 5 site HTML form webhookSigned JSON to your endpoint for every message Angular contact formA standalone component that posts with HttpClient Contact form spamWhy forms get spam, and the layers that stop it Contact form honeypotThe hidden field that catches bots, and how to hide it Contact form without PHPFor hosts with no PHP, or mail() that lands in spam HTML form mailtoWhy action="mailto:" fails on webmail visitors, and the one-line fix Contact form templateThe same form in plain HTML Pricing€1 per form a month, €0.50 from the 11th

Get your form address in a minute

14 days free, no card. Then €1 per form a month, €0.50 from the 11th form.

Start your 14-day trial