All guides

Jekyll guide

Add a contact form to a Jekyll site

Jekyll sites, including those built by GitHub Pages, are static: there is no server to handle a form. One include file posting to Formcrate fixes that, with no plugins.

  1. 1Create a form and copy its key

    Sign up with Google, create a form and enter the email address that should receive submissions. Copy the form key from the dashboard: it replaces YOUR_FORM_KEY below. The free plan includes 500 submissions a month.

  2. 2Add your form key to the config

    Restart jekyll serve after editing _config.yml.

    _config.yml
    formcrate_key: YOUR_FORM_KEY
  3. 3Create an include

    _includes/contact-form.html
    <form action="https://www.formcrate.dev/api/submit/{{ site.formcrate_key }}" method="POST">
      <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="text" name="_gotcha" style="display:none" tabindex="-1" autocomplete="off" />
      <input type="hidden" name="redirectTo" value="{{ '/thanks/' | absolute_url }}" />
      <button type="submit">Send</button>
    </form>
  4. 4Use it in any page

    Includes work in Markdown pages and layouts alike.

    contact.md
    ---
    layout: page
    title: Contact
    ---
    
    {% include contact-form.html %}
  5. 5Send a test submission

    Fill in the form on your site and submit it. The message appears in your Formcrate inbox and arrives by email within a few seconds. Anything that looks like spam goes to the Spam tab instead and isn't emailed.

  6. 6Lock the form to your domain

    Your key is visible in the page source, which is normal for form backends. In the form settings, add your domain under Domain lock so other websites can't post to your form from the browser.

Tips

  • Set url in _config.yml so absolute_url produces your real domain.

Get your Jekyll form working

Free for 500 submissions a month. Spam filtering, email alerts and an inbox included. No card required.

Create a free form

Guides for other stacks