11ty Plugin: HubSpot

npm npm npm npm license license

This plugin adds shortcodes to your Eleventy project to easily embed HubSpot forms and meetings calendars.

Installation

Install the plugin from npm:

npm install eleventy-plugin-hubspot --save-dev

Configuration

Add it to your Eleventy Config file:

ESM (Eleventy 3.x+)

import eleventyPluginHubspot from 'eleventy-plugin-hubspot';

export default function (eleventyConfig) {
    eleventyConfig.addPlugin(eleventyPluginHubspot, {
        portalId: 1234567
    });
}

CommonJS (Eleventy 2.x)

const eleventyPluginHubspot = require('eleventy-plugin-hubspot');

module.exports = function (eleventyConfig) {
    eleventyConfig.addPlugin(eleventyPluginHubspot, {
        portalId: 1234567
    });
};

Options

Loading Modes

Usage

HubSpot Forms

{% hubspotForm "your-form-id" %}

{# With options #}
{% hubspotForm "your-form-id", { locale: "es" } %}

HubSpot Meetings

{% hubspotMeetings "https://meetings.hubspot.com/your-meeting-link" %}

Demo

Below are live HubSpot forms using the lazy loading mode with scriptAttributes: { "data-ot-ignore": "true" } for OneTrust bypass.

Form Example

Meetings Example

Advanced: OneTrust / Cookie Consent Bypass

eleventyConfig.addPlugin(eleventyPluginHubspot, {
    portalId: 1234567,
    loadingMode: "interact",
    scriptAttributes: {
        "data-ot-ignore": "true",
        "data-cookieconsent": "ignore"
    }
});

License

MIT License


Fork me on GitHub