MuxForms on Eleventy registers a shortcode in .eleventy.js that outputs the div and script, used in src/contact.njk. Allow your static host origin after build.
Docs
Eleventy templates compile to static HTML—inject the embed via shortcode so writers never touch script tags.
| Piece | Role |
|---|---|
| .eleventy.js | shortcode muxForm |
| contact.njk | {{ muxForm() }} |
| Passthrough | No assets needed |
| Deploy | Netlify / CF Pages |
module.exports = function (eleventyConfig) {
eleventyConfig.addShortcode("muxForm", function () {
const id = process.env.MUX_FORM_ID || "FORM_UUID";
return `<div data-form-id="${id}"></div>
<script src="https://www.muxforms.com/embed.js" defer></script>`;
});
};---
title: Contact
layout: base.njk
---
<h1>Contact</h1>
{% muxForm %}Shortcode once; reuse on support and careers pages.
Upgrade to Pro