1. Save your Public Key
Copy the Public Key from the Endpoint form’s General tab and add it to your site configuration:hugo.toml
config.toml. Put the setting in whichever one you already have.
2. Create the shortcode
layouts/shortcodes/contact-form.html
redirect field sends visitors to your own thank-you page after a successful submission. It is not stored as an answer.
3. Add the pages
Create the page that shows the form:content/contact.md
content/thank-you.md
hugo server, open /contact/, and send a test response. Then check Submissions in the dashboard.
Good to know
- Make sure
baseURLis set to your live address before you deploy;absURLuses it to build the redirect link. - You can use the shortcode on as many pages as you like. To collect from a second form, create a second Endpoint form and a second shortcode with its own key.
- Want a message on the same page instead of a redirect? Use the JavaScript example inside the shortcode.