Guides Jekyll
Contact form for a Jekyll site
Jekyll builds a static site, so it has nowhere to receive a form. Put the form in an include, point it at sendm8, and every submission arrives in your inbox. It works anywhere Jekyll does, GitHub Pages included.
Create the include
Save the form as _includes/contact-form.html. The endpoint comes from _config.yml, so you can change it in one place.
<form action="{{ site.form_endpoint }}" method="POST">
<label>Your email <input name="email" type="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/' | absolute_url }}">
<button>Send</button>
</form>url: "https://yoursite.com"
form_endpoint: "https://sendm8.com/f/you@example.com"Change you@example.com to your own address. absolute_url builds the thank-you link from url (and baseurl, for project sites), so make sure those are set.
Use it on a page
Jekyll’s kramdown passes HTML through, so the include works in Markdown and in layouts alike.
---
layout: page
title: Contact
permalink: /contact/
---
Send me a message and I’ll get back to you.
{% include contact-form.html %}Add a thanks.md with permalink: /thanks/ for the page visitors land on, or remove the _next line to use sendm8’s plain thank-you page.
Confirm your address once
- The first time anyone submits, sendm8 stores the message and emails
you@example.com(well, your address) one confirmation link. Click it and that message, plus anything that arrived meanwhile, is delivered. After that, submissions just arrive. - Notifications come from
notify@sendm8.com, with the visitor’s email as Reply-To. - Run
bundle exec jekyll serveand the form works locally too: posts from localhost are always allowed.
Themes like Minima and Minimal Mistakes
Some themes have a contact form built in, often configured for Formspree. Point its action at your sendm8 endpoint. sendm8 accepts the same underscore fields (_replyto, _subject, _next, _gotcha, _cc), so the rest of the theme’s form can stay as it is.
Taking file uploads
To accept files, add enctype="multipart/form-data" to the form and use a normal <input type="file">. Each file can be up to 5 MB, with 10 MB and 5 files per submission. Files are stored with the submission, and your notification links to them rather than attaching them, so nobody’s inbox fills up.
Spam and limits
The honeypot, rate limits, spam scoring and an AI check run on every submission. Flagged messages wait in a spam folder for 30 days instead of reaching you.
A no-account endpoint keeps up to 100 submissions a month and delivers by email. Sign in with the same address and the form moves into your account: 1,000 submissions a month, a dashboard inbox with search and CSV export, and Discord, Slack, Telegram or webhook delivery.
Questions
- Can Jekyll handle form submissions?
- No. Jekyll only generates static pages. Post the form to a form backend such as sendm8, which receives the submission and emails it to you.
- Will this work on GitHub Pages?
- Yes. GitHub Pages builds Jekyll sites, and the form posts straight to sendm8, so nothing extra runs on GitHub.
- Can I send submissions to Slack or Discord instead?
- Yes, once you sign in. Create the form in the dashboard and add Discord, Slack, Telegram or webhook channels to it.