diff options
author | IChou <me@ichou.cn> | 2016-10-23 09:45:27 +0300 |
---|---|---|
committer | IChou <me@ichou.cn> | 2016-10-23 09:46:10 +0300 |
commit | a738d428abba742e490ba33137f74ccff8f9ccf4 (patch) | |
tree | 69a354f8afc0524165796a6ff623340fc9a43179 /layouts | |
parent | d5a616acf70d3a75c1c093f58d6ac0720334023a (diff) |
add formspree support #1
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/single.html | 2 | ||||
-rw-r--r-- | layouts/page/single.html | 5 | ||||
-rw-r--r-- | layouts/partials/disqus.html | 2 | ||||
-rw-r--r-- | layouts/partials/formspree.html | 13 |
4 files changed, 20 insertions, 2 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 891a85c..eeaf346 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -29,7 +29,7 @@ {{ end }} </section> - {{ partial "disqus.html" . }} + {{ if .Params.comments }}{{ partial "disqus.html" . }}{{ end }} </div> {{ partial "footer.html" . }} diff --git a/layouts/page/single.html b/layouts/page/single.html index c19795e..665095f 100644 --- a/layouts/page/single.html +++ b/layouts/page/single.html @@ -15,7 +15,12 @@ <div class="post-content"> {{ .Content }} </div> + + {{ if .Params.formspree }}{{ partial "formspree.html" . }}{{ end }} + </section> + + {{ if .Params.comments }}{{ partial "disqus.html" . }}{{ end }} </div> {{ partial "footer.html" . }} diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html index db86ed7..5fea4b6 100644 --- a/layouts/partials/disqus.html +++ b/layouts/partials/disqus.html @@ -1,4 +1,4 @@ -{{ if and .Site.DisqusShortname .Params.comments }} +{{ if .Site.DisqusShortname }} <section id="disqus_thread" class='disqus'></section> <script> var disqus_config = function () { diff --git a/layouts/partials/formspree.html b/layouts/partials/formspree.html new file mode 100644 index 0000000..c940e2c --- /dev/null +++ b/layouts/partials/formspree.html @@ -0,0 +1,13 @@ +{{ if .Site.Params.Email }} +<hr /> +<div id="formspree" class='formspree'> + <h2>CONTACT ME</h2> + <form action="https://formspree.io/{{ .Site.Params.Email }}" method="POST"> + <input type="text" name="_gotcha" style="display:none" /> + <input type="hidden" name="subject" value="comment to: {{ .Title }}"> + <input type="email" name="email" placeholder="Your email" required> + <textarea name="message" placeholder="Your message" rows=5 required></textarea> + <button type="submit">Send</button> + </form> +</div> +{{ end }} |