Skip to content

Pelican Guide

Here is a guide on integrating a contact form into a Pelican site using Fabform:

Integrating a Contact Form into your Pelican Site with Fabform

Pelican is a static site generator written in Python, making it a versatile choice for building websites and blogs. Adding a contact form to your Pelican site can enhance user engagement and make it easier for visitors to reach out to you. Let’s walk through the steps to integrate a contact form using Fabform:

Step 1: Install Pelican and Create a New Site

Start by installing Pelican and creating a new site with the following commands:

Terminal window
python -m pip install "pelican[markdown]"
mkdir -p ~/projects/yoursite
cd ~/projects/yoursite
pelican-quickstart

Step 2: Add a Contact Section

Create a new page for your contact form. Give it the necessary attributes, including title, slug, and language. For example:

Title: Contact
Slug: contact
Lang: en

Step 3: Implement the Contact Form

In your contact page file (e.g., content/contact.md), add the following HTML code to implement the contact form:

<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>

Make sure to replace {your-form-endpoint} with your actual Fabform endpoint URL.

Step 4: Configure Page URLs

In your pelicanconf.py file, set the URLs for your pages using the following settings:

PAGE_URL = '{slug}/'
PAGE_SAVE_AS = '{slug}/index.html'

This ensures that your contact page is accessible at http://yoursite.com/contact/.

Step 5: Preview Your Site

Generate your Pelican site and preview it locally to finalize the setup:

Terminal window
pelican content
pelican --listen

Your Pelican site with the contact form will now be running locally at http://localhost:8000/contact/.

Conclusion

Congratulations! You’ve successfully integrated a contact form into your Pelican site using Fabform. This allows visitors to easily reach out to you, enhancing the interactivity of your site. Feel free to customize the form further to meet your specific requirements.

Happy publishing!


This guide provides a comprehensive walkthrough for integrating a contact form into a Pelican site using Fabform, ensuring clarity and completeness in each step of the process.