Adding the contact form to a static site: Hugo, Jekyll and Eleventy
How to use the free forms with a static site generator, and what to do if your host doesn't run PHP.
The following areas are covered in this guide:
- The short answer
- Will it work on my host?
- Where the form's folders go
- Putting the form on a page
- Keep your password out of Git
- Testing on your own computer
- If your host doesn't run PHP
- Changing or upgrading the form
The short answer
Yes, the form works with Hugo, Jekyll, Eleventy and other static site generators, as long as the built site is uploaded to hosting that runs PHP. The generator only builds your pages. The form sends its messages with PHP, and that runs on your web server, not in the generator.
So it comes down to two things: getting the generator to copy the form's two folders into your built site without changing them, and putting the form's HTML on one of your pages. Both are covered below.
Will it work on my host?
| Where your built site goes | Does the form work? |
|---|---|
| Shared or cPanel hosting (for example Namecheap, Hostinger, Bluehost, GoDaddy, SiteGround) | Yes |
| Your own server or VPS with PHP 8.2 or newer | Yes |
| GitHub Pages, Netlify, Cloudflare Pages, Vercel | No. These only serve static files and can't run PHP. See if your host doesn't run PHP. |
Hosting that runs the form needs PHP 8.2 or newer and an email account to send through. No database. See the requirements.
Where the form's folders go
The download has two folders, fcf-assets and fcf-config. They must end up side by side in your built site, exactly as they are. The form looks for fcf-config next to fcf-assets. The examples below put them at the top of the site, so they're at /fcf-assets/ and /fcf-config/.
Hugo
Put both folders in your project's static folder. Hugo copies everything in it to the built site without changing it.
my-site/
static/
fcf-assets/
fcf-config/
Jekyll
Put both folders in the top of your project. Jekyll copies files that have no front matter as they are, and the form's files have none. Jekyll skips folders starting with an underscore, which these don't.
my-site/
_config.yml
fcf-assets/
fcf-config/
Eleventy
Put both folders in the top of your project and tell Eleventy to copy them as they are, in your Eleventy config file:
eleventyConfig.addPassthroughCopy("fcf-assets");
eleventyConfig.addPassthroughCopy("fcf-config");
Check
After building, open your output folder (public, _site or similar) and check both folders are there, including the .htaccess files in fcf-config, fcf-assets/inc and fcf-assets/classes. Their names start with a dot, which some tools skip. On Apache hosting, they stop anyone downloading the files in those folders. Jekyll copies .htaccess files unless you've set your own include: list in _config.yml. If you have, add .htaccess to it.
Putting the form on a page
Open fcf.form.htm from the download. You need the two style sheet lines from its <head> and everything between <!-- the lines below are needed --> and <!-- the lines above are needed -->.
Change the five paths to start with a slash, so they work from any page on your site, whatever folder it's built into:
<link href="/fcf-assets/css/fcf.default.css?v=2026.2" rel="stylesheet"> <link href="/fcf-config/css/fcf.custom.css" rel="stylesheet"> <form ... action="/fcf-assets/fcf.process.php"> <script src="/fcf-assets/js/lang/fcf.en.js?v=2026.2"></script> <script src="/fcf-assets/js/fcf.form.js?v=2026.2"></script>
Then put the form in a file of its own and include it in your contact page. This keeps the form's HTML away from your Markdown, which can change or hide it. The style sheet lines can go in your site's <head>, or at the top of the same file.
Hugo
Hugo's Markdown leaves out raw HTML unless you change a setting, so use a shortcode. Save the form as layouts/shortcodes/contact-form.html, then put this where you want it in your contact page's Markdown:
{{< contact-form >}}
Jekyll
Save the form as _includes/contact-form.html, then in your contact page:
{% include contact-form.html %}
Eleventy
Save the form as _includes/contact-form.html, then in your contact page (Markdown, Nunjucks or Liquid):
{% include "contact-form.html" %}
Keep the credit line ("Contact form by FreeContactForm") visible with the form, as set out in the licence, or buy an unbranding licence to remove it.
Keep your password out of Git
fcf-config/fcf.settings.php holds the password of the email account the form sends through. Most static sites live in a Git repository, often a public one, so don't commit this file.
- Leave fcf.settings.php out of your project, or add it to .gitignore:
static/fcf-config/fcf.settings.php # Hugo fcf-config/fcf.settings.php # Jekyll and Eleventy
- Fill it in and upload it straight to fcf-config on your server, once, with FTP or your host's file manager.
- Make sure your deploy doesn't delete it. Tools that make the server match your output folder (for example rsync --delete, or an FTP "delete remote files" option) will remove it, because it isn't in your build. Exclude fcf-config/fcf.settings.php from the delete.
Changing the form later never touches this file: the form builder doesn't include it.
Testing on your own computer
hugo server, jekyll serve and npx @11ty/eleventy --serve don't run PHP. The form will show and check its fields, but it can't send.
To test sending, build the site, then run PHP's own server in the output folder (PHP 8.2 or newer):
cd public # or _site php -S localhost:8000
Then open your contact page at http://localhost:8000/. You'll need fcf.settings.php in the output's fcf-config folder for this, with a real email account using SMTP. Or skip all this and test on your live site.
If your host doesn't run PHP
GitHub Pages, Netlify, Cloudflare Pages and Vercel can't run this form. You have three choices:
- Use your host's own form feature or a form service, for example Netlify Forms or Formspree. That's the simplest choice if it does what you need. See form services compared with self-hosted forms.
- Put the contact page on PHP hosting. Use a subdomain such as contact.yourdomain.com on any low-cost PHP hosting, with the contact page, fcf-assets and fcf-config there. Link to it from your site, or show it in an <iframe> on your contact page (give the iframe a fixed height that fits the form).
- Move the whole site to hosting that runs PHP. Your generator works the same way: you just upload the output folder there instead.
Pointing the form on a Netlify or GitHub Pages page at the PHP files on another website won't work. The form sends with JavaScript, and browsers block that from one website to another. The form page and its two folders must be on the same website, which is why the iframe in option 2 works: the page inside it is on the PHP hosting.
Changing or upgrading the form
To change the fields, colours or email, use the form builder and download the 5 files made for this form. Put the four files for fcf-config in your project's copy of that folder, and copy the new form HTML from fcf.form.htm into your include or shortcode file, with the paths changed as above.
To upgrade to a newer version, replace the fcf-assets folder in your project with the new one, update the ?v= numbers in your include file, then build and upload. The installation guide explains upgrading in full.
Something not working? See the help and FAQ page, or the installation guide for every setting.