diff --git a/wowchemy/layouts/partials/widgets/contact.html b/wowchemy/layouts/partials/widgets/contact.html index be93d7da..01bba0c8 100644 --- a/wowchemy/layouts/partials/widgets/contact.html +++ b/wowchemy/layouts/partials/widgets/contact.html @@ -3,53 +3,60 @@ {{ $autolink := default true $st.Params.autolink }} {{ $data := site.Params }} +{{ $form_provider := lower $st.Params.contents.form.provider | default "" }} +{{ $form_provider_legacy := $st.Params.email_form | default 0 }} +{{ $use_netlify_form := eq $form_provider "netlify" | or (eq $form_provider_legacy 1) }} +{{ $use_formspree_form := eq $form_provider "formspree" | or (eq $form_provider_legacy 2) }} +{{ $use_form := or $use_netlify_form $use_formspree_form }} + {{ $columns := $st.Params.design.columns | default "2" }}
{{ with $st.Content }}{{ . }}{{ end }} - {{ if $st.Params.email_form }} + {{ if $use_form }} - {{ $post_action := "" }} - {{ if eq $st.Params.email_form 1 }} - {{ $post_action = "netlify" }} - {{ else }} - {{ if not $data.email }} - {{ errorf "Please set an email address for the contact form using the `email` parameter in `params.toml`. Otherwise, set `email_form = 0` to disable the contact form." }} - {{ end }} - {{ $post_action = printf "action=\"https://formspree.io/%s\"" $data.email }} - {{end}} + {{ $post_action := "" }} + {{ if $use_netlify_form }} + {{ $post_action = "netlify" }} + {{ else if $use_formspree_form }} + {{ if not $st.Params.contents.form.formspree.id }} + {{ errorf "You have chosen to use Formspree as the provider for the contact form. Please set your Formspree Form ID in the Contact widget or disable the form." }} + {{ errorf "Documentation: https://wowchemy.com/docs/page-builder/#contact" }} + {{ end }} + {{ $post_action = printf "action=\"https://formspree.io/f/%s\"" $st.Params.contents.form.formspree.id }} + {{end}} -
-
-
- - -
-
- - -
-
- - -
- {{ if eq $st.Params.email_form 1 }} -
- -
- {{ end }} - {{ if $st.Params.netlify.captcha }} -
- {{ end }} - -
-
+
+
+
+ + +
+
+ + +
+
+ + +
+ {{ if $use_netlify_form }} +
+ +
+ {{ if $st.Params.contents.form.netlify.captcha }} +
+ {{ end }} + {{ end }} + +
+
{{end}}