Add a contact form to a Jekyll site with an include and a Formcask endpoint. No mail gems or GitHub Pages-unsafe plugins.
Jekyll renders HTML at build time. A contact form on a Jekyll site needs a hosted POST target; you do not need a mail gem or a custom plugin (important if you deploy to GitHub Pages, which allows only a short plugin list).
Create _includes/contact-form.html:
<form action="https://formcask.com/f/f_YOUR_FORM_ID" method="POST">
<label>Name <input type="text" name="name" required></label>
<label>Email <input type="email" name="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="_redirect" value="{{ site.url }}{{ site.baseurl }}/thanks/">
<button type="submit">Send</button>
</form>
Set url in _config.yml to your live https:// origin so the thank-you link is absolute. Include the form from a page or layout with {% include contact-form.html %}.
Build with bundle exec jekyll build (or let GitHub Pages build it). Test a submission from the deployed site, not only from localhost.
Related: GitHub Pages · Hugo · Plain HTML