Hugo Guide
Add A Contact Form To Hugo
Here is a guide for integrating Fabform with a Hugo site:
Step 1: Create a new Hugo site
If you haven’t set up a Hugo site yet:
-
Install Hugo: You can install Hugo via Homebrew:
Terminal window brew install hugo -
Create Hugo Site: Run the following commands to create a new Hugo site named
quickstart
:Terminal window hugo new site quickstartcd quickstart -
Start Hugo Server: Launch the Hugo development server:
Terminal window hugo server -D
Hugo will start a hot-reloading development environment accessible at http://localhost:1313/
.
Step 2: Add a Contact Form to your Hugo site
-
Create Contact Page: Inside the
content
directory of your Hugo site, create a new markdown file namedcontact.md
. -
Update Contact Page Content: Replace the content of
contact.md
with the following code block:---title: Contact Usdate: 2020-11-27 17:30:49---<form accept-charset="UTF-8" action="https://fabform.io/f/{your-form-endpoint}" method="POST"><input type="email" name="email" placeholder="Your Email"><input type="text" name="name" placeholder="Your Name"><input type="text" name="message" placeholder="Your Message"><button type="submit">Send</button></form>Note: Replace
{your-form-endpoint}
with the unique form endpoint provided by Fabform.
Step 3: Run your Hugo site locally to finalize setup
-
Start Hugo Server: Run the following command to see your Hugo form in action at
localhost:1313/contact/
:Terminal window hugo server -D
That’s it! Your Hugo site is now integrated with Fabform for handling form submissions.