Spica Jekyll documentation
Newsletter and contact form
Connect Spica's newsletter to Buttondown, Kit, MailerLite or Mailchimp, send the contact form with Formspree, Web3Forms or Netlify, and learn what demo mode does.
A static site can’t receive form messages, so each form posts to a service that handles them. Both forms need no JavaScript. Both start in demo mode, which sends nothing.
Newsletter
The newsletter is a panel at the bottom of the home page, with an email field and a “Subscribe” button. It’s set in _config.yml:
- Create a list with Buttondown, Kit, MailerLite or Mailchimp.
- Copy the form address (the action URL) your provider gives you.
- Set the provider and the address:
spica:
newsletter:
provider: buttondown
action: https://buttondown.com/api/emails/embed-subscribe/your-name
provider is one of none, demo, buttondown, kit, mailerlite or mailchimp. Each provider names the email field differently, and Spica uses the right name for each one, so the address is all you need to supply.
The form posts to the provider and opens its confirmation in a new tab, so your visitor’s page stays where it was. What happens next (a confirmation email, a welcome message) is set up in your provider’s account.
provider: noneremoves the panel from the home page.- If
provideris a real service butactionis missing, the form acts as demo mode.
The same form on another page
The panel’s form is a piece you can use anywhere. In a page or post, write:
{% include newsletter-form.html id="about-newsletter" %}
id keeps the field and its label linked when a page holds two forms. Add label=false to hide the line above the field. It uses the same settings as the home page, so there’s nothing else to set.
Contact form
The form is on the Contact page, contact.html. Next to it, the page shows your email address (spica.contact.email) and your profile links. Where the form sends is set in _config.yml under spica.contact. All three fields (name, email and message) are required, and the browser checks that the email looks like an email.
Formspree
- Create a form at formspree.io and copy its address, such as
https://formspree.io/f/abcdwxyz. - In
_config.yml:
spica:
contact:
provider: formspree
action: https://formspree.io/f/abcdwxyz
email: hello@example.com
The first message asks you to confirm your email address. Spica passes your thank-you page to Formspree as the place to send visitors afterwards. Whether Formspree follows it can depend on your plan, so send a test message and check where you land.
Web3Forms
- Go to web3forms.com, enter your email address and get your access key.
- In
_config.yml:
spica:
contact:
provider: web3forms
key: your-access-key
email: hello@example.com
Messages arrive by email, and visitors are sent to your /thank-you/ page. This needs url to be set in _config.yml. The access key only lets people send messages to you, so it’s safe in a public repository. Without a key, the form acts as demo mode.
Netlify
spica:
contact:
provider: netlify
email: hello@example.com
Use this only when the site is hosted on Netlify. Netlify finds the form when it builds the site (the form is named contact) and collects the messages in your Netlify dashboard. After a message is sent, visitors see your thank-you page. It needs no action or key. See Publishing.
What the form sends
Name, email and message, plus a subject line that visitors never see. The subject is form_subject in _data/strings.yml (“New message from your website”). Reword it there.
Every provider also gets a hidden spam-trap field that people never see and bots fill in: _gotcha for Formspree, botcheck for Web3Forms and bot-field for Netlify.
The contact form on another page
{% include contact-form.html id="help" %}
Use an id when a page holds two forms. It uses the same settings.
Demo mode
provider: demo is how both forms are set when you get the theme. They send nothing: the form goes straight to the thank-you page. The fields have no names, so nothing a visitor types leaves the page or appears in the address bar.
Change both before you launch, or your visitors’ messages will be lost. Any other value for the contact form’s provider, or a missing action (Formspree) or key (Web3Forms), also acts as demo mode.
The thank-you page
thank-you.html is where visitors land after either form. It says “Thanks for getting in touch. If you sent a message, I read every one and reply as soon as I can.” While the newsletter provider or the contact provider is demo, a small note under it says the site is in demo mode and nothing was sent. The note disappears once neither form is in demo mode. A newsletter set to none doesn’t count as demo.
To change the words, set thank_you_text in _data/strings.yml. The note is demo_note there. The page is hidden from search engines and left out of the sitemap.
The form’s words
The field labels, the “Send message” and “Subscribe” buttons, the placeholder and the line above the newsletter field come from _data/strings.yml. The heading and intro on the Contact page are in the front matter of contact.html (title and lead).