<form> can post to your endpoint. The Public Key goes in a global data file so every template can use it.
1. Save your Public Key
Copy the Public Key from the Endpoint form’s General tab. Create a global data file inside your input directory’s_data folder:
_data/site.json
_data is available to every template as a variable named after the file—here, site.
2. Create the contact page
This example uses Nunjucks, but the{{ }} tags work the same in Liquid.
contact.njk
3. Create the thank-you page
thank-you.njk
npx @11ty/eleventy --serve, open /contact/, and send a test response. Confirm it appears in Submissions.
Good to know
- Change
layout: base.njkto the layout your site already uses. - While testing locally, the redirect points to
site.url, so you will land on your live address. Temporarily seturltohttp://localhost:8080, or leave out theredirectfield while you test. - To show a message without leaving the page, use the JavaScript example in your template.