Skip to content

Commit

Permalink
Merge pull request #7 from genebean/form-updates
Browse files Browse the repository at this point in the history
Add support for Netlify to contact form
  • Loading branch information
tfsomrat authored Jan 21, 2023
2 parents 57f572b + fa0dfbb commit c19a83c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
5 changes: 4 additions & 1 deletion exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ custom_script = ""

mainSections = ["blog"]

# contact form works with https://formspree.io and Netlify
# use Netlify's contact form functionality
netlify = true # set to false if using formspree.io
# contact form action
contact_form_action = "#" # contact form works with https://formspree.io
contact_form_action = "#"
# copyright
theme_copyright = true
copyright = "Copyright by your company"
Expand Down
9 changes: 6 additions & 3 deletions exampleSite/content/english/contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ title: "Contact"
description: "this is meta description"
layout: "contact"
draft: false
form_name: "contact"
---

# Contact Me

Menso comes with a built-in contact form, that you can use with Formspree service to
handle up to 50 submissions per month for free. You could also easily switch to another
contact form service if you want
iWriter comes with a built-in contact form that you can use with Netlify or the Formspree.
[Netlify](https://docs.netlify.com/forms/usage-and-billing/#app) allows for 100 submissions per month for free.
[Formspree](https://formspree.io/plans) provides up to 50 submissions per month for free.
You can also easily switch to another contact form service if you want.

9 changes: 6 additions & 3 deletions layouts/_default/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
<div class="pb-5">
{{ .Content }}
</div>

<form action="{{ site.Params.contact_form_action }}" method="post">
<form action="{{ site.Params.contact_form_action }}" method="post" {{ with .Params.form_name }}name="{{ . }}"{{ end }} {{ if site.Params.netlify }}data-netlify="true" netlify-honeypot="always-empty"{{ end }}>
<div class="row g-4">
<div class="col-md-6 mb-3 mt-0">
<input type="text" class="form-control" placeholder="{{ i18n `first_name`}}" aria-label="{{ i18n `first_name`}}" name="{{ i18n `first_name`}}" required>
Expand All @@ -24,6 +23,9 @@
<div class="col-12 mb-3 mt-0">
<textarea rows="7" class="form-control mb-4" placeholder="{{ i18n `message`}}" id="floatingTextarea" name="{{ i18n `message`}}" required></textarea>
</div>
<div hidden="true">
<input type="text" class="form-control" placeholder="Don’t fill this out if you’re human:" name="always-empty">
</div>
<div class="col-12 mb-3 mt-0">
<button type="submit" class="btn btn-primary btn-md">{{ i18n `submit`}}</button>
</div>
Expand All @@ -38,4 +40,5 @@
</section>
<!--===================== Contact End =====================-->

{{ end }}
{{ end }}

0 comments on commit c19a83c

Please sign in to comment.