Connecting your HTML form

Contact form for Eleventy

Eleventy generates static pages and runs no code after the build. FormPost receives the submitted form and sends you the input by email.

Before you start: create a form in FormPost

Sign up for FormPost, create a form and enter the domain your site runs on. We then show you your form's address. It replaces https://www.formpost.eu/f/abc123 in the code below – nothing else needs to change.

1. Create the form as an include

By default Eleventy looks for includes in the _includes folder. Save the form there as a plain HTML file.

_includes/contact-form.html
<form action="https://www.formpost.eu/f/abc123" method="POST">
  <label for="email">Email</label>
  <input type="email" id="email" name="email" required>

  <label for="message">Message</label>
  <textarea id="message" name="message" required></textarea>

  <input type="text" name="_gotcha" style="display:none;" tabindex="-1" autocomplete="off">

  <button type="submit">Send</button>
</form>

2. Use the include on a page

Include the form on your contact page with a single line. The quotes around the file name are required.

contact.md
{% include "contact-form.html" %}

Good to know

  • By default Eleventy processes Markdown files with Liquid first. The include tag therefore works in .md files just as it does in Nunjucks or Liquid templates.
  • We only accept submissions from the domain you entered. Submissions from the local server (eleventy --serve on localhost) are rejected; to try things out, use the test form in your dashboard.
  • The form ships without its own CSS and takes on your site's styling. Add classes and further fields in the include as you like.

What FormPost cannot do today

  • Forms are submitted the classic way, meaning the page changes. Sending in the background via JavaScript is not supported at present.
  • We do not accept file attachments.
  • FormPost does not collect consent from your visitors. The notice in your own privacy policy remains your job – the wording for it is waiting, ready to copy, next to your form.

More guides and comparisons

Create a form and try it

The Free plan covers one form with ten notifications a day and costs nothing, permanently.