After we have a working 11ty site, we will hook up our contact form using Basin. If you already have a working 11ty site you can skip to the next section.
Make a Project Directory
mkdir eleventy-sample
cd eleventy-sample
Create a Package JSON
npm init -y
Install Eleventy into your package by using npm
npm install --save-dev @11ty/eleventy
Run Eleventy to make sure it is installed properly
npx @11ty/eleventy
Wrote 0 files in 0.03 seconds (v1.0.0)
Run Eleventy again in order to compile your site using the new templates.
npx @11ty/eleventy
Writing _site/README/index.html from ./README.md
Writing _site/index.html from ./index.html
Processed 2 files in 0.12 seconds (v1.0.0)
Open your browser and point it to localhost:8080 and you should see the layout we just created. As you can see 11ty is a very powerful and simple static site generator. Very cool!
Basic 11ty example.
Use Basin for your 11ty Contact Form
Start by creating a free Basin account and making your first form. Then copy the basic example from the setup page. This example will include the correct form endpoint for you to use. Basin Setup Instructions Now let's add this Example HTML to our index.html by editing it as follows:
Now you can see your updated site by refreshing the page. Make sure to use your form endpoint in the example above as I've included my unique endpoint ID. Contact form added to 11ty Contact Form Let's try submitting our form.
Basin form success page. Basin Inbox.
And it emails you a copy as well. Basin submission email notification. Bonus points: Deploy this to AWS Amplify or Cloudflare pages and point a domain to it. Done!
Anthony is one of the technical co-founders of Basin. He is an avid programmer and outdoorsman. You can reach him at @AnthonyPenner and anthony@usebasin.com
Get Started with a Free Basin account today!
Discover the benefits of Basin and how it can help streamline your forms. Sign up now and explore our features.