Capella Jekyll documentation
Newsletter and contact forms
Connect Capella's newsletter to Buttondown, Kit, MailerLite or Mailchimp, send the contact form with Web3Forms or Formspree, 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 form is one line with an email field and a “Subscribe” button. It appears in the footer (when capella.footer is full) and in the sidebar’s newsletter box. Both use the same settings, 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:
capella:
newsletter:
provider: buttondown
action: https://buttondown.com/api/emails/embed-subscribe/your-name
provider is one of demo, buttondown, kit, mailerlite or mailchimp. Each provider names the email field differently, and Capella 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.
If provider is a real service but action is missing, the form acts as demo mode.
The hero’s “Subscribe” link points at #newsletter, which is the footer’s form. That anchor exists only with footer: full. With footer: compact, change the link or add the newsletter box to the sidebar.
Contact form
The form is set on the contact block in contact.html, under form:. Use the split or form variant to show it. See Pages and blocks.
Web3Forms
- Go to web3forms.com, enter your email address and get your access key.
- In
contact.html:
form:
provider: web3forms
access_key: your-access-key
subject: New message from your website
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.
Formspree
- Create a form at formspree.io and copy its address, such as
https://formspree.io/f/abcdwxyz. - In
contact.html:
form:
provider: formspree
endpoint: https://formspree.io/f/abcdwxyz
subject: New message from your website
The first message asks you to confirm your email address. Capella 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.
Where visitors go afterwards
Set redirect in the form to send visitors to a page other than /thank-you/:
form:
provider: web3forms
access_key: your-access-key
redirect: /thanks-for-writing/
What the form sends
Name, email, subject and message. The email and message are required, and the browser checks the email address before sending. The name and subject are optional.
Both services also get a hidden spam-trap field that people never see and bots fill in. Web3Forms gets it as botcheck and Formspree as _gotcha.
subject is the subject line of the email you receive. If you leave it out, the words come from form_subject in _data/strings.yml.
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 one, also acts as demo mode.
The thank-you page
thank-you.html is where visitors land after either form. It says “Thanks! You’re all set. If you sent a message, I read every one and reply as soon as I can.” While capella.newsletter.provider is demo, a small note under it says the site is in demo mode and nothing was sent; the note disappears once you choose a newsletter provider. To change the words, edit the heading and text of its page-head block (the note is demo_note in _data/strings.yml). The page is hidden from search engines and left out of the sitemap.
The form’s words
The field labels, the “Send message” button and the “Subscribe” button come from _data/strings.yml. The text around the contact form (the heading, the intro and the details card) is in the contact block of contact.html.