splitforms.com

Contact form · Eleventy

Contact form for Eleventy (11ty) websites

11ty's beauty is its simplicity — and a contact form should match. One Nunjucks (or Liquid) include, one form tag, no serverless function in sight. Pull the access key from global data, render zero JavaScript, and ship submissions straight to your inbox.

  • 500 free / mo
  • 14ms latency
  • No backend code
Eleventy contact form — copy-paste code for splitforms

No backend code

No server, API route, or SDK. Your Eleventy form posts straight to one endpoint.

Straight to your inbox

Every submission is emailed to you and saved to a searchable dashboard — spam filtered before it reaches you.

Design without limits

It's your own Eleventy markup and styles. Splitforms is only the backend, so nothing constrains how the form looks.

Copy-paste ready

Your Eleventy contact form, ready to paste.

Replace YOUR_ACCESS_KEY with the key from your dashboard — that's the whole integration. No SDK to install, no build step, just the html you already write.

Generate access key
contact.html
{#
  src/_includes/partials/contact-form.njk
  Use in any template with: {% include "partials/contact-form.njk" %}
  Set ACCESS_KEY in .env and expose it via eleventy.config.js (addGlobalData)
#}

<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="{{ splitformsKey }}" />

  <input type="text"  name="name"    placeholder="Name"  required />
  <input type="email" name="email"   placeholder="Email" required />
  <textarea           name="message" placeholder="Message" required></textarea>

  <input type="checkbox" name="botcheck" style="display:none" tabindex="-1" />

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

How to add it

How to add a contact form to a Eleventy website.

To add a contact form to a Eleventy website you need three things: a free splitforms access key, the html snippet above, and your key pasted into it. No backend, server, or SDK — the form posts to one URL and every submission lands in your inbox and dashboard.

Get your free splitforms access key

Sign up at splitforms.com, verify your email, and copy your access key from the dashboard. No credit card required.

Drop the Eleventy snippet into your project

Copy the Eleventy code example into your project and replace YOUR_ACCESS_KEY with the key from step 1.

Receive submissions in your dashboard

Submissions arrive in the splitforms dashboard within seconds. Free includes inbox delivery; Pro adds Slack, Discord, Sheets, or any signed webhook URL.

Where submissions go

Where do your Eleventy form submissions go?

Every submission is emailed to you and saved to a searchable dashboard — spam filtered before it ever reaches you. Search, export to CSV, or forward it to a webhook or Slack on Pro.

  • 500 submissions per month, free forever
  • Honeypot + AI spam classifier on every plan
  • Signed webhooks to Slack, Discord, your server
Eleventy contact form submissions in the splitforms dashboard

No backend needed

Do you need a backend for a Eleventy form? No.

Your Eleventy form posts standard FormData to one URL. Splitforms validates the access key, runs the spam classifier, and forwards it to your email — so there's no server, API route, or database for you to build or maintain.

  • Reusable Nunjucks / Liquid include — drop into any layout
  • No serverless function, Cloud Run, or Cloudflare Worker required
  • Access key pulled from global data, kept out of templates and version control
How splitforms processes a Eleventy form submission

Best practices

What a production-ready Eleventy form needs.

The difference between a form that works in the demo and one that survives launch traffic — the production-tested defaults, in priority order.

  • Define the key in _data/site.js (not site.json), reading from process.env.SPLITFORMS_KEY. Add a .env file to gitignore. Local dev and production both read from environment.
  • Use a Nunjucks include ({% include "partials/contact-form.njk" %}) so the form is reusable across templates without copy-paste.
  • Build the /thanks page as a normal Eleventy content file (content/thanks.md), then set its absolute URL in Dashboard → Form settings → Redirect.
Production-ready Eleventy contact form best practices

How SplitForms works

From form to workflow in 3 simple steps.

Connect your form, collect every submission, and send data where it needs to go — without building backend infrastructure.

A SplitForms contact form submission launching straight to your inbox

Add your endpoint

Point your form to your unique SplitForms endpoint. That's it.

HTML form pointing at a SplitForms submit endpoint

Receive submissions

We instantly capture and organize every submission in your inbox.

Submissions inbox with searchable leads and status pills

Route anywhere

Send data to email, spreadsheets, CRMs, webhooks, and 7,000+ apps.

Generic integration tiles for email, sheets, chat, CRM, automate, and webhook

No credit card required. Set up in under 60 seconds.

Connect & automate

Connect your favorite tools and automate everything

SplitForms works with the destinations you route to and the platforms you build on — from Slack and Sheets to WordPress, Shopify, and Next.js.

Connect your SplitForms form to Slack, Google Sheets, Mailchimp, Zapier and more

Trusted by indie teams and agencies shipping forms worldwide

PETAL/COKRAFT.DELINEAR-XBUILD.DEVSTUDIO 71MERIDIANFRAME&CO

Testimonials

Loved by developers shipping at every scale.

40 quotes on record — from indie hacks to agency migrations.

Questions

Eleventy contact form questions.

View all FAQs
How do I add a contact form to Eleventy?

Save the snippet as src/_includes/partials/contact-form.njk. Add splitformsKey to your global data (in _data/site.js, reading from process.env.SPLITFORMS_KEY). Then {% include "partials/contact-form.njk" %} from any template.

Does splitforms work with Eleventy v2 and v3?

Yes — both. The form template is plain HTML with Nunjucks/Liquid syntax that hasn't changed across versions. The only v3 gotcha is that your config file must be ESM (.mjs).

How do I handle form errors in 11ty?

Eleventy is static — it can't render dynamic error responses. Two options: (1) use the pure-HTML form and let splitforms render its default error page (configurable in dashboard), or (2) add a small inline <script> that intercepts submit and renders inline errors (see the AJAX page).

Can I use splitforms with Eleventy and Liquid templates?

Yes. The snippet is in Nunjucks but the same logic in Liquid is one-line different: {% include 'partials/contact-form.liquid' %} and use {{ splitformsKey }} directly (Liquid doesn't need the URL filter). Save the file with .liquid extension.

How do I customize the success / redirect behavior?

Build a /thanks Markdown file with your normal layout, then set its absolute URL in Dashboard → Form settings → Redirect. Splitforms sends native form submissions there after success. Submitted redirect fields are ignored.

Will this work with 11ty serverless / Eleventy on Netlify?

Yes. The form posts to splitforms.com directly from the static HTML, so it works regardless of whether the page itself was built statically or by Netlify's on-demand builders. No Netlify Function code required.

Eleventy v3 is ESM-only — your config must be .mjs

If you upgraded to Eleventy 3 and your .eleventy.js (CommonJS) silently stopped exposing globals, that's why. Rename to eleventy.config.mjs and use ESM export default. Otherwise addGlobalData('splitformsKey', …) won't reach your templates.

Keep the thank-you URL in the dashboard, not the template

Build the thank-you page as normal Eleventy content, then configure its absolute URL in Dashboard → Form settings → Redirect. Do not add a submitted redirect field to Nunjucks or Liquid templates; splitforms ignores it for security.

Global data with sensitive values gets committed by accident

If you put your access key in _data/site.json (the obvious place), it ships to your repo. Use _data/site.js and read from process.env.SPLITFORMS_KEY instead — then add .env to gitignore. Eleventy auto-loads .env if you have dotenv installed.

Permalinks: false on the contact page makes the redirect fail

If the thank-you page has permalink: false, it is not built and the URL configured in the splitforms dashboard points at a 404. Ensure both the form and thank-you pages have valid permalinks.

Pagination data clobbers your `splitformsKey` global

If you reuse the variable name splitformsKey inside a paginated template's data, Eleventy's data cascade has paginated data win over global data. Use a unique-enough name like siteSplitformsKey to avoid the conflict.

Eleventy serverless (`eleventy-plugin-serverless`) bundles env vars at build, not request time

If you use eleventy-plugin-serverless to render the contact page on-demand via Netlify Functions, you might assume process.env.SPLITFORMS_KEY is read per-request. It isn't — Eleventy serverless bundles the rendered template into a Netlify Function during build, capturing the env vars from your build environment. Rotating the key in Netlify's dashboard does nothing until the next deploy. Fix: read the key inside the form template via <%= process.env.SPLITFORMS_KEY %> rendered at request time using a Nunjucks {% raw %} escape, or skip serverless rendering for the contact page.

How does Eleventy handle forms without splitforms?

Eleventy is a Node-based static site generator — it produces HTML at build time and ships nothing else. There is no runtime, no /api/contact endpoint, no hooks for handling a form POST. The historical workarounds: (a) deploy to Netlify and use Netlify Forms, (b) write a Cloudflare Worker that handles POST /contact and forwards to your email provider (~4 hours plus ongoing operation), or (c) use a third-party form API (Formspree, Web3Forms, Basin, splitforms). Eleventy's data cascade lets you neatly pull an access key from _data/site.js and use it in a Nunjucks/Liquid include — but the actual delivery layer is always external. Splitforms is the lowest-friction external option.

Any deployment notes for shipping Eleventy to production?

Eleventy deploys to any static host. The form posts cross-origin to splitforms.com so the host is irrelevant for delivery. Eleventy v3's ESM-only config is the major upgrade gotcha — .eleventy.js (CommonJS) silently stops exposing globals; rename to eleventy.config.mjs. Local dev runs on localhost:8080 — add to splitforms allowed-domains for testing or use a separate dev key. _data/site.js (not .json) lets you read from process.env; keep .env in gitignore. For 11ty + Netlify (the classic combo), Netlify Forms is free and unlimited on current credit plans; splitforms is useful when the endpoint must work on every host.

Simple pricing

Start free. Scale when you need more.

Choose a plan that fits your workflow — from a free form endpoint to full automations, exports, and higher submission limits.

Free

$0

Free forever

 
Best for testing

For side projects and indie devs.

  • 500 submissions / mo
  • Unlimited forms
  • Email notifications included
  • Honeypot spam filtering
  • Submissions dashboard
  • MCP setup stays free
  • No credit card required

3-Year

$59/ 36 months
was $99 · save 40% · new-user price

Pay $59. 3 years sorted.

  • 15,000 submissions / mo
  • Unlimited forms
  • Everything in Pro
  • Renews every 3 years
  • Long-term discount
  • Priority support included
  • Vote on the roadmap

No credit card required on Free • Cancel anytime