Github contact form with jekyll? [closed]
Asked Answered
E

7

28

I'm planning on building and deploying a static site on github. If i was to do that is it still possible to have a contact form?

It seems that's the only set of dynamic functionality that's going to exist on my particular website.

Would i have to create a service somewhere else to create the contact form?

Englis answered 1/8, 2013 at 1:52 Comment(1)
You’ll have to create a service somewhere else to create the contact form, in which case you’d probably be better off just hosting a simple PHP site elsewhere, like Heroku; or hosting your Jekyll installation elsewhere and having a plugin written in Ruby that handles contact form submissions.Defaulter
R
38

Yes, you'll need to use an external service. A great external service for this that requires no signup and is free for up to 1000 submissions per month is Formspree.

Other options: Simple Form (Free), FormKeep ($19/mo.), & Wufoo (Free & Paid Options)

Rufena answered 2/1, 2015 at 5:39 Comment(6)
That's clearly not a good implementation as it does not protect your email address at all.Crenelation
Formspree it's not free! @Josh BucheaMoloch
github.com/formspree/formspree seems to be available as self host also. This is most great newsTracheitis
I've studied several similar services, and getsimpleform.com appears to be the best (free, no email address in HTML code, file attachments, akismet integration, ajax support) The mailing service itself, as well as protected area, works perfect. But some things make my worry. 1. Their they are referring in docs is gone, and then squatted by some video service. 2. Their support doesn't answer. Are they alive, or tomorrow the service will go down and never up again?Hadlee
Check www.enformed.io, has a couple of interesting features, like setting the redirect after submiting, and email customization.Dacy
Another alternative is kvstore.io (disclaimer: I've built it). Basically there's a feature (called "public write") that allows to inject a Javascript into your static page. This JS gives you a simple post function that you can use to store your data (whatever it is) into the storage. It's a very easy but powerful setup...Vociferance
H
5

Simple Form seems to be an interesting option to get around the static site aspect of Jekyll.

Wufoo is also a good option.

Humbuggery answered 9/5, 2014 at 14:41 Comment(0)
R
2

Super-simple fast form setup with Jekyll is to use an external service like https://formkeep.com

Reader answered 16/10, 2014 at 5:57 Comment(0)
V
2

Yes, you need something external to store your data. But the good news is that so many solutions exist out there and you just have to pick up the "best" for your specific needs.

Just give me the opportunity to include in the landscape of the possible solutions also KVStore.io (disclaimer: I'm the author).

If you have enough time I just posted an article on how to store user-generated content from Jekyll/GitHub Pages or similar...

But the tl;dr of story is that by using KVStore.io you still can benefit of a true storage engine (with simple and rich set of RESTful API) supporting "client-side only environments" like "jekyll/github pages" or whatever combinations you like..

My 2 cents

Vociferance answered 20/11, 2015 at 14:21 Comment(0)
U
1

Precisely. The (usual) result of Jekyll' compilation process is a static site, thus the only way of having dynamic functionality is through external services.

For example, you could try zappyforms.

Unapt answered 1/8, 2013 at 13:49 Comment(1)
zappyforms seem to be dead already :(Hadlee
D
1

formspree.io works like a charm (Read more...)

Dumps answered 20/5, 2016 at 20:0 Comment(0)
S
-3

If you want to create your own contact form with, say PHP for example, you can do it. Just remember these two things:

  1. Jekyll will copy anything not preceded with an underscore or ignored verbatim to the _site directory.

  2. You can include an HTML file into a PHP file.

I am using a PHP library on my server to deliver mail from an HTML contact form created by Jekyll. My issue, though, is the lack of server-side validation or notification to the user of a un/successfull delivery or what fields did not validate. I'd rather not have a custom Success.html and Fail.html page for responses.

This is how I got around it.

My Jekyll structure looks like this:

/..
 _config.yml
 _layouts/
   default.html
   default-php.html
 _includes/
   header.html
   footer.html
   contact-form.html
   nav.html
 ...
 about/
   index.md => index.html
 services/
   index.md => index.html
 contact/
   contact.md => contact.html
   index.php (includes contact.html)

My contact-form.html include and default-php.html layout both contain PHP snippets to print variables.

When someone browses to www.mysite.com/contact it will load index.php which contains my full HTML page with snippets of PHP code to print variables.

At the top of that PHP file you can process $_POST or $_GET data from your contact form or returned from your mail delivery script and print messages to the sender or even add classes to the form fields to indicate they failed validation.

One drawback is that This will not load in Jekyll's local server (localhost:4000). Maybe with some jiggering you can get it. I'm not sure. I simply setup a vhost to point mysite.local to /web/root/myjekyllsite/_sites and it works fine.

Supine answered 11/9, 2013 at 4:15 Comment(3)
I understand that this can work on your own server, but when using Github Pages (like @Englis mentioned), this doesn't work, since Github Pages doesn't do any server-side processing. So the answer (to the last question) is yes, a service outside of Github must be used.Humbuggery
The OP specifically mentions deploying the site on Github, so PHP won't work.Gram
I think this is the best answer on that page. PHP and any other backend will work if you run your backendlogic outside of github pages. I dont see how advertisment to paid serices as formspree is any better answer.Clance

© 2022 - 2024 — McMap. All rights reserved.