summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--assets/sass/_customize.scss2
-rw-r--r--exampleSite/config.toml4
-rw-r--r--exampleSite/content/about.md1
-rw-r--r--exampleSite/content/contact.md2
-rw-r--r--exampleSite/content/thanks.md9
-rw-r--r--layouts/robots.txt1
-rw-r--r--layouts/shortcodes/form-contact.html16
-rw-r--r--resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content5
9 files changed, 32 insertions, 9 deletions
diff --git a/README.md b/README.md
index 043e95f..88d7493 100644
--- a/README.md
+++ b/README.md
@@ -61,6 +61,7 @@ to generate high-quality editions on github.io in large quantities based on the
- Unobtrusive footnotes
- Metadata in OpenGraph to play nice with social media and search engines
- Automatic table of content generation
+- Contact form
## License
diff --git a/assets/sass/_customize.scss b/assets/sass/_customize.scss
index b9465af..60f463e 100644
--- a/assets/sass/_customize.scss
+++ b/assets/sass/_customize.scss
@@ -5,6 +5,7 @@
}
#page-contact,
+#page-thanks,
.introduction {
min-height: 40px;
margin-bottom: 40px;
@@ -26,6 +27,7 @@
}
#page-contact .container,
+#page-thanks .container,
.introduction .container {
margin: 10px auto;
max-width: 600px;
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 9224727..31b696c 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -151,9 +151,11 @@ disableKinds = ['RSS']
[params.contact]
# Formspree URL, used in contacts form
- formAction = 'https://formspree.io/f/example'
+ formAction = 'https://submit-form.com/example'
# Contact form email subject
emailSubject = 'Contact form submission'
+ # After successful submit, where should the user be redirected?
+ thanksUrl = '/thanks'
[params.assets]
# Site icons, relative to ./static
diff --git a/exampleSite/content/about.md b/exampleSite/content/about.md
index 5b8fd5f..f900d71 100644
--- a/exampleSite/content/about.md
+++ b/exampleSite/content/about.md
@@ -45,6 +45,7 @@ for you, Kindle!
- Unobtrusive footnotes
- Metadata in OpenGraph to play nice with social media and search engines
- Automatic table of content generation
+- Contact form
## Installing and using Ed
diff --git a/exampleSite/content/contact.md b/exampleSite/content/contact.md
index 56147cb..05c1bb8 100644
--- a/exampleSite/content/contact.md
+++ b/exampleSite/content/contact.md
@@ -3,6 +3,6 @@ title: Contact
description: We'd love to hear from you
---
-This is an example of a custom shortcode that you can put right into your content. You will need to add a form action to the the shortcode to make it work. Check out [Formspree](https://formspree.io/) for a simple, free form service.
+This is an example of a custom shortcode that you can put right into your content. You will need to add a form action to the the shortcode to make it work. Check out [Formspark](https://formspark.io/) for a simple, free form service.
{{< form-contact >}}
diff --git a/exampleSite/content/thanks.md b/exampleSite/content/thanks.md
new file mode 100644
index 0000000..cf5e6bc
--- /dev/null
+++ b/exampleSite/content/thanks.md
@@ -0,0 +1,9 @@
+---
+title: Thank you
+private: true
+---
+
+Your message will be sent within a short time.
+We'll answer as soon as possible.
+
+[&larr; Back to Home](/).
diff --git a/layouts/robots.txt b/layouts/robots.txt
index c07f0df..53082b7 100644
--- a/layouts/robots.txt
+++ b/layouts/robots.txt
@@ -3,6 +3,7 @@
User-agent: *
{{- if eq (getenv "HUGO_ENV") "production" | or (eq site.Params.env "production") }}
Allow: /
+Disallow: /thanks
Sitemap: {{ "/stemap.xml" | absURL }}
{{- else }}
diff --git a/layouts/shortcodes/form-contact.html b/layouts/shortcodes/form-contact.html
index d2e0c99..3be7777 100644
--- a/layouts/shortcodes/form-contact.html
+++ b/layouts/shortcodes/form-contact.html
@@ -1,24 +1,26 @@
{{- /* TODO: Translate me */ -}}
<div class="contact-form">
- <form accept-charset="UTF-8" action="{{ site.Params.Contact.formAction | default "example.com" }}" method="POST" id="contact-form">
+ <form accept-charset="UTF-8" action="{{ site.Params.Contact.formAction | default site.BaseURL }}" method="POST" id="contact-form">
<div class="contact-form-item">
<label for="name" class="contact-form-label">Your name</label>
- <input type="text" id="name" name="name" class="contact-form-input form-input" placeholder="Your name" required aria-labelledby="name">
+ <input type="text" id="name" name="name" class="contact-form-input form-input" placeholder="" required aria-labelledby="name">
</div>
<div class="contact-form-item">
<label for="email" class="contact-form-label">Email addres</label>
- <input type="email" id="email" name="email" class="contact-form-input form-input" placeholder="Email addres" required aria-labelledby="email">
+ <input type="email" id="email" name="email" class="contact-form-input form-input" placeholder="" required aria-labelledby="email">
</div>
<div class="contact-form-item">
<label for="message" class="contact-form-label">Message</label>
- <textarea id="message" name="message" class="contact-form-textarea form-input" placeholder="Message" required aria-labelledby="message"></textarea>
+ <textarea id="message" name="message" class="contact-form-textarea form-input" placeholder="" required aria-labelledby="message"></textarea>
</div>
- <input type="hidden" name="_language" value="{{ site.Language.Lang }}" >
- <input type="hidden" name="_subject" value="{{ site.Params.Contact.emailSubject | default "Contact form submission" }}">
- <input type="text" name="_gotcha" style="display:none" class="contact-form-gotcha" value="">
+ <input type="hidden" name="_feedback.language" value="{{ site.Language.Lang }}" >
+ <input type="hidden" name="_email.subject" value="{{ site.Params.Contact.emailSubject | default "" }}">
+ <input type="hidden" name="_redirect" value="{{ site.Params.Contact.thanksUrl | absURL }}">
+
+ <input type="checkbox" name="_honeypot" style="display:none" tabindex="-1" autocomplete="off" class="contact-form-gotcha" value="">
<div class="contact-form-item">
<input type="submit" value="Send" class="button button-large">
diff --git a/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content b/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content
index bf3c8c4..1b04769 100644
--- a/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content
+++ b/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content
@@ -858,25 +858,30 @@ form input:-moz-ui-invalid {
font-size: .78rem; }
#page-contact,
+#page-thanks,
.introduction {
min-height: 40px;
margin-bottom: 40px; }
@media only screen and (min-width: 768px) {
#page-contact,
+ #page-thanks,
.introduction {
min-height: 60px;
margin-bottom: 60px; } }
@media only screen and (min-width: 1024px) {
#page-contact,
+ #page-thanks,
.introduction {
min-height: 80px;
margin-bottom: 80px; } }
@media only screen and (min-width: 1220px) {
#page-contact,
+ #page-thanks,
.introduction {
min-height: 100px;
margin-bottom: 100px; } }
#page-contact .container,
+#page-thanks .container,
.introduction .container {
margin: 10px auto;
max-width: 600px;