Beginner4 minUpdated Mar 27, 2026

How to Add a Contact Form to Eleventy (11ty)

Add a contact form to your Eleventy site using Nunjucks templates. No server code or serverless functions needed. FormsList handles everything.

TL;DR

To add a contact form to an Eleventy site, create an HTML form in a Nunjucks template with action set to `https://formslist.com/f/your-form-id`. Eleventy generates static HTML, so FormsList handles submissions, email notifications, and spam filtering without any server code.

By Vaibhav Jain·Published March 27, 2026

Prerequisites

  • An Eleventy (11ty) project
  • A FormsList account (free)
  • Basic knowledge of Nunjucks or Liquid templates
1

Create a FormsList form endpoint

Sign up for a free FormsList account and create a new form. Copy the endpoint URL. You will use it as the form action in your Eleventy template.

2

Create the contact form template

Create a Nunjucks template for your contact page. The form uses a standard HTML POST action pointing to your FormsList endpoint. You can also create this as a reusable Nunjucks include.

{# src/contact.njk #}
---
layout: base.njk
title: Contact Us
permalink: /contact/
---

<h1>{{ title }}</h1>
<p>Get in touch with us using the form below.</p>

<form action="https://formslist.com/f/YOUR_FORM_HASH" method="POST" class="contact-form">
  <div class="form-group">
    <label for="name">Name</label>
    <input type="text" id="name" name="name" required />
  </div>

  <div class="form-group">
    <label for="email">Email</label>
    <input type="email" id="email" name="email" required />
  </div>

  <div class="form-group">
    <label for="message">Message</label>
    <textarea id="message" name="message" rows="5" required></textarea>
  </div>

  {# Optional: redirect after submission #}
  <input type="hidden" name="_redirect" value="/thanks/" />

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

Create a reusable include (optional)

For reuse across multiple pages, extract the form into a Nunjucks include file and reference it with the include tag.

{# _includes/contact-form.njk #}
<form action="https://formslist.com/f/YOUR_FORM_HASH" method="POST" class="contact-form">
  <div class="form-group">
    <label for="name">Name</label>
    <input type="text" id="name" name="name" required />
  </div>
  <div class="form-group">
    <label for="email">Email</label>
    <input type="email" id="email" name="email" required />
  </div>
  <div class="form-group">
    <label for="message">Message</label>
    <textarea id="message" name="message" rows="5" required></textarea>
  </div>
  <button type="submit">Send Message</button>
</form>

{# Use in any page: #}
{# {% include "contact-form.njk" %} #}

Frequently Asked Questions

Does this work with Liquid templates instead of Nunjucks?

Yes. Eleventy supports multiple template languages. The HTML form markup is identical: just change the file extension to .liquid and use Liquid syntax for any template logic.

Can I use Eleventy data files to configure the form endpoint?

Yes. Add your FormsList endpoint URL to a global data file like _data/site.json, then reference it in your template as {{ site.formslistUrl }}. This makes it easy to update across all pages.

Does this work with Eleventy's serverless or edge functions?

You do not need serverless or edge functions. Since FormsList handles the backend, your Eleventy site stays fully static. This works on any hosting provider without special server capabilities.

Ready to collect form submissions?

200 free submissions a month and a live endpoint in 30 seconds. No server, no credit card, just point your form at it.

Sign up with emailView pricing