Written by: Geoffrey Callaghan
create a contact form with Docsify
Create A Contact Form With Docsify
Creating a contact form in a Docsify site using FabForm is straightforward. Docsify is a JavaScript documentation site generator, and FabForm is a service for handling form submissions. Here’s a step-by-step guide to integrate a contact form into a Docsify site using FabForm:
Set Up Docsify Project:
npm i docsify-cli -g
docsify init ./docs
cd docs
Create a Contact Page:
contact.md
in your docs
directory:
# Contact Us
<form action="https://fabform.io/f/YOUR_FORM_ID" method="POST">
<div>
<label for="name">Name:</label><br>
<input type="text" id="name" name="name" required><br>
</div>
<div>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" required><br>
</div>
<div>
<label for="message">Message:</label><br>
<textarea id="message" name="message" required></textarea><br>
</div>
<div>
<input type="submit" value="Submit">
</div>
</form>
Configure FabForm:
Update Sidebar Navigation:
_sidebar.md
file to add the contact page to your navigation:
* [Home](/)
* [Contact](/contact)
Run Your Docsify Site:
docsify serve .
http://localhost:3000/#/contact
to ensure your contact form appears correctly and can submit data.Deploy Your Site:
docs/
├── index.html
├── README.md
├── contact.md
└── _sidebar.md
index.html
:Make sure your index.html
includes the necessary Docsify scripts and configuration:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Docsify Site</title>
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
</head>
<body>
<div id="app"></div>
<script>
window.$docsify = {
name: '',
repo: '',
loadSidebar: true
};
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</body>
</html>
contact.md
:# Contact Us
<form action="https://fabform.io/f/YOUR_FORM_ID" method="POST">
<div>
<label for="name">Name:</label><br>
<input type="text" id="name" name="name" required><br>
</div>
<div>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" required><br>
</div>
<div>
<label for="message">Message:</label><br>
<textarea id="message" name="message" required></textarea><br>
</div>
<div>
<input type="submit" value="Submit">
</div>
</form>
_sidebar.md
:* [Home](/)
* [Contact](/contact)
By following these steps, you will have a fully functional contact form on your Docsify site that integrates with FabForm for handling submissions.