To create a contact form using MkDocs with FabForm, you’ll need to follow several steps. MkDocs is a static site generator that’s geared towards project documentation, and FabForm is a form handling service. Here’s a step-by-step guide on how to integrate a contact form into an MkDocs site using FabForm:
Set Up MkDocs Project:
pip install mkdocs
mkdocs new my-project
cd my-project
Install MkDocs Material Theme (optional but recommended):
pip install mkdocs-material
mkdocs.yml
to use the Material theme:
site_name: My Docs
theme:
name: 'material'
Create a Contact Page:
docs
directory, create a file named contact.md
.contact.md
:
# Contact Us
<form action="https://fabform.io/f/YOUR_FORM_ID" method="POST">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name" required><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" required><br>
<label for="message">Message:</label><br>
<textarea id="message" name="message" required></textarea><br>
<input type="submit" value="Submit">
</form>
Configure FabForm:
Test Your Site:
mkdocs serve
http://127.0.0.1:8000/contact/
to ensure your contact form appears correctly and can submit data.Deploy Your Site:
mkdocs build
mkdocs.yml
):site_name: My Docs
theme:
name: 'material'
nav:
- Home: index.md
- Contact: contact.md
docs/contact.md
):# Contact Us
<form action="https://fabform.io/f/YOUR_FORM_ID" method="POST">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name" required><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" required><br>
<label for="message">Message:</label><br>
<textarea id="message" name="message" required></textarea><br>
<input type="submit" value="Submit">
</form>
By following these steps, you’ll have a fully functional contact form on your MkDocs site that integrates with FabForm for handling submissions.