Skip to content
Sign inJoin waitlist

Forms — Denzel HTML

The Denzel HTML template has one form: the newsletter box (“Newsletter”, “Join 89,000 subscribers!”) in the footer of every page. It sends to the form service or webhook of your choice.

The box takes an e-mail address and a “Sign Up” button. The browser checks that the address looks right before sending; while sending, the button shows “…”; then it says “Thank you!” (or “Something went wrong” if the service failed) and the field is cleared. A hidden honeypot field drops spam.

Out of the box it runs in demo mode: nothing is sent, and the e-mail is logged in the browser console. Pick a destination before you publish.

A static site has no server of its own, so sign-ups go to a form service or a webhook. All of these have a free tier:

Service What it does formEndpoint
Formspree Emails you each sign-up, keeps a list https://formspree.io/f/<form id>
Web3Forms Emails you each sign-up, no account needed https://api.web3forms.com/submit, and your key in formAccessKey
Getform, Basin Inbox, email, integrations The form’s endpoint URL
Zapier, Make, n8n, Pipedream Send sign-ups anywhere: Mailchimp, Brevo, ConvertKit, a Google Sheet, Slack The webhook (“catch hook”) URL
  1. Create a form at the service and copy its endpoint.

  2. Open assets/js/config.js and paste it:

    window.siteConfig = {
    formEndpoint: "https://formspree.io/f/abcdwxyz",
    formAccessKey: "", // Web3Forms only
    };
  3. Serve the folder (npx serve .), sign up with your own address in the footer and check that it arrived.

  4. Upload config.js with the site.

Every page loads the same config.js, so the newsletter box sends to the same place from every page (the copy in the style guide’s footer too).

Each field by its name, as multipart/form-data:

Field Name Required
The e-mail address email yes
newsletter (hidden) form
“New newsletter subscriber” (hidden) subject

form and subject let you tell the sign-ups apart in your inbox or tool. With formAccessKey set, the box also sends it as access_key. The honeypot field (fax) is left out. The request asks for a JSON answer (Accept: application/json), so the service answers the page instead of showing its own thank-you page.

The box is a <form data-newsletter …> in the footer of every page:

<form data-newsletter data-success="Thank you!" data-error="Something went wrong" method="post" …>
<input type="email" name="email" required autocomplete="email" aria-label="name@email.com" placeholder="name@email.com" … />
<input type="hidden" name="form" value="newsletter" />
<input type="hidden" name="subject" value="New newsletter subscriber" />
<input type="text" name="fax" tabindex="-1" autocomplete="off" aria-hidden="true" class="sr-only" />
<button type="submit" data-newsletter-button …> Sign Up</button>
<span aria-live="polite" data-newsletter-status class="sr-only"></span>
</form>
  • The texts: “Sign Up” is in the button; “Thank you!” and “Something went wrong” are the form’s data-success and data-error; the placeholder and its spoken name are the field’s placeholder and aria-label. “Newsletter” and “Join 89,000 subscribers!” are above the form.
  • The subject of each sign-up is the value of the hidden subject field: put your own wording in it.
  • To add a field (a name, say), copy the e-mail <input>, give it type="text", a new name and its own placeholder and aria-label. The service receives whatever the form contains. Don’t name a field fax: it is the honeypot’s. Keep the e-mail field’s name email: the script checks it.

The footer is the same in all 41 files, so make a change with find and replace in files (search for data-newsletter data-success or for the line you change).

  • Sign up from the live site with a real address and check that it arrived.
  • The service must answer with a success status (2xx). If it doesn’t, the button says “Something went wrong”. Try it once by pasting a wrong endpoint into config.js on your local copy.
  • The browser console tells you what happened: in demo mode it logs [forms] demo mode — set formEndpoint in assets/js/config.js to send submissions with the fields; after a failure, [forms] could not send the form with the reason.

The honeypot stops the usual bots: the box carries a hidden field named fax that a person never sees; a bot that fills it is shown “Thank you!” and nothing is sent. The services above filter spam on their side as well. The endpoint is visible in the page source, which is how these services are designed to work.

Sign-ups go only where you point them. Most countries expect you to say what happens to the addresses people give you, and many expect a confirmation e-mail (double opt-in) before you send a newsletter: your mailing tool usually does that. The line “By signing up, you agree to our Privacy Policy” under the box is plain text, and the template has no privacy page: write one (copy a page, see Editing the site) and link the words to it. The box has no consent checkbox; add one with required if your readers need it.