Eleventy Guide
Add A Contact Form To Eleventy
Step 1: Create a new form endpoint on Fabform
- Sign up or Log in: If you haven’t already, sign up or log in to Fabform.
- Create a New Form: Specify a name for your form. This name will help you identify your form later. Fabform will provide a unique form endpoint URL for your Eleventy form.
Step 2: Prepare your Gatsby contact form for your website
-
Use Boilerplate Code: Fabform provides boilerplate code for a basic contact form with fields for email address, name, and message.
Step 3: Create a new blank 11ty site
If you don’t have an existing 11ty site:
-
Clone Eleventy Base Blog: Run the following commands to clone the Eleventy Base Blog repository, navigate into it, and install dependencies:
-
Start Eleventy Server: Run Eleventy to serve your site locally:
Step 4: Add a Contact Section to your 11ty site
-
Create Contact Section: Create a new folder named
contact
under the root directory of your site. -
Create Markdown File: Inside the
contact
folder, create a new markdown file namedindex.md
. Update its content with the following code block:Important: Replace
{YOUR_UNIQUE_FORM_ENDPOINT}
with the form endpoint URL provided by Fabform in Step 1.
Step 5: Run your 11ty site locally to finalize setup
-
Serve Eleventy Site: Run the following command to see your Eleventy form in action at
localhost:8000/contact/
:
That’s it! Your 11ty site now integrates with Fabform, allowing you to receive form submissions seamlessly. You can customize the form’s appearance and behavior as needed.
This guide should provide a more detailed and comprehensive walkthrough for setting up a contact form in an Eleventy site using Fabform.