For a static site like those on GitHub Pages, everything is done in the frontend. The user just downloads a bunch of static files that execute in their browser. But for a “Contact” form, to deal with the submissions we typically need a backend service, either self-hosted or a third a third-party service.
Here, I’m going to summaries several possible solutions that could fulfil the contact form logic.
Link with mailto
The idea of this simple solution comes from Simple Backends: Four ways to implement a “Contact Us” form on a static website. When I searched for the solutions for this topic, it already presents several great methods for our purpose. To get information from users, we could simply use a mailto: link that open users’ default e-mail client for submission.
Also, you can customize the look of this form with CSS styles. But one drawback of this method is your e-mail address is now publicly available that may give you loads of spam e-mails. Dealing this needs some JavaScript to encrypt the mailto link, like https://jumk.de/nospam/stopspam.html; or you can use base64 string for this link and turn it back when users clicked on it using JavaScript.
Third-party services
There is a long list of third-party services for this purpose. I just pick up two of them I’ve tried.
Wuffo
It’s a great service which lets you build a contact form in seconds, and you can embed the form in your webpages with an iframe. You can even place multiple forms on your page. Wanna try this? Simply go to https://www.wufoo.com/gallery/templates/forms/contact-form/ and play around with it.
Formspree
Formspree gives you more control over your contact form, and lets you have more configurations like reCAPTCHA. You don’t even need to sign up an account and Formspree will forward the submission to your personal e-mail.
Also, you can place a custom page to the action attribute that redirects when the form successfully submitted. You can configure the Netlify app to forward the e-mail to your Slack workspace for your convenient.
More advanced configurations like spam filtering and AJAX submission are well documented here: https://www.netlify.com/docs/form-handling/. Also, notice that the limit for a free plan is 100 form submissions per month. For now, it’s totally enough for me, and I’m pleased with such a simple way of a functional contact form. I might try the FaaS way later if needed.
Small chat
One more alternative is using small.chat, which lets you talk to your users directly through Slack channel, a way of contact directly.
small chat screen shot
This is different to traditional forms, but it could do the same job and gives you more functions.
Okay, that’s all for now, choose the best for your need.
THE END
Ads by Google
林宏
Frank Lin
Hey, there! This is Frank Lin (@flinhong), one of the 1.41 billion . This 'inDev. Journal' site holds the exploration of my quirky thoughts and random adventures through life. Hope you enjoy reading and perusing my posts.
IBM Cloud CLI allows complete management of the Cloud Functions system. You can use the Cloud Functions CLI plugin-in to manage your code snippets in actions, create triggers, and rules to enable your actions to respond to events, and bundle actions into packages.
IKEv2, or Internet Key Exchange v2, is a protocol that allows for direct IPSec tunnelling between networks. It is developed by Microsoft and Cisco (primarily) for mobile users, and introduced as an updated version of IKEv1 in 2005. The IKEv2 MOBIKE (Mobility and Multihoming) protocol allows the client to main secure connection despite network switches, such as when leaving a WiFi area for a mobile data area. IKEv2 works on most platforms, and natively supported on some platforms (OS X 10.11+, iOS 9.1+, and Windows 10) with no additional applications necessary.
Liquid is a simple template language that Jekyll uses to process pages for your site. With Liquid you can output complex contents without additional plugins.