Guides GitHub Pages
Add a contact form to a GitHub Pages site
GitHub Pages serves static files and nothing else, so there’s no server to receive a form. You don’t need one: point the form at sendm8 and submissions are emailed to you. It works the same on a user site, an organisation site or a project site.
Add the form
Create a page in your repository, for example contact.html at the root (or docs/contact.html if you publish from /docs), and paste the form. Change you@example.com to the address you want messages sent to.
<form action="https://sendm8.com/f/you@example.com" method="POST">
<label>Your email <input name="email" type="email" required></label>
<label>Message <textarea name="message" required></textarea></label>
<!-- Honeypot: people never see it, bots fill it in -->
<input type="text" name="_gotcha" style="display:none" tabindex="-1" autocomplete="off">
<button>Send</button>
</form>Commit and push. Once GitHub has rebuilt the site, open the page and send yourself a test message.
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. - Messages reach you from
notify@sendm8.com, with the visitor’s address set as Reply-To. - Nothing else to set up: there are no keys to keep out of your public repository, because the endpoint only ever delivers to the confirmed address.
Using Jekyll on GitHub Pages
GitHub Pages builds with Jekyll by default, and Jekyll passes raw HTML in Markdown straight through. So you can paste the form into contact.md under its front matter, or save it as _includes/contact-form.html and use {% include contact-form.html %} wherever you want it. The Jekyll guide covers that in more detail.
Send visitors back to your site
Without anything extra, visitors see a short thank-you page with a link back. To use your own page, add a _next field pointing at it. Because it’s on the same site as the form, it works without any settings.
<input type="hidden" name="_next" value="https://username.github.io/thanks.html">For a project site, the page lives under the repository name, such as https://username.github.io/my-project/thanks.html. A custom domain works the same way: use the full address your visitors see.
Spam and limits
GitHub Pages sites get found by bots like any other site. The _gotcha honeypot, rate limits, spam scoring and an AI check run on every submission, and anything flagged waits in a spam folder rather than your inbox.
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
- Does GitHub Pages support forms?
- GitHub Pages hosts the form’s HTML but can’t receive submissions, because it only serves static files. Point the form’s action at a form backend like sendm8 to receive them.
- Is it safe to put the endpoint in a public repository?
- Yes. The endpoint can only deliver to the address that confirmed it, so someone copying it can only send you messages. Spam filtering and rate limits still apply.
- Does it work with a custom domain on GitHub Pages?
- Yes. The form posts to sendm8 from whatever domain the page is on. Use your custom domain in any _next redirect.