Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

Gatsby Source Iubenda Documents

npm semantic-release

Source plugin for pulling in Iubenda documents for Gatsby. (Privacy Policy, Cookie Policy,Terms and Conditions)

🚀 Install

With npm:

npm install --save gatsby-source-iubenda-documents

Or with Yarn:

yarn add gatsby-source-iubenda-documents

🎮 Usage

First, visit your Iubenda dashboard and select your project. You’ll find your document id from the embeded section. You can use multiple ids (ex: multiple languages).

https://www.iubenda.com/privacy-policy/<your-document-id>

And use it to setup the plugin in Gatsby:

// In your gatsby-config.js
plugins: [
  {
    resolve: `gatsby-source-iubenda-documents`,
    options: {
     documentIds: [
       `<your-document-id>`,
       `<your-document-id-2>`
     ]
    },
  },
];

Your privacy policy, cookie policy and terms will be available in graphql:

// With one document
query MyQuery {
  iubendaDocument {
    termsAndConditions
    cookiePolicy
    privacyPolicy
  }
}

// Get a specific document
query MyQuery {
  iubendaDocument(documentId: {eq: "<your-document-id>"}) {
    documentId
    privacyPolicy
    cookiePolicy
    termsAndConditions
  }
}


// get all documents
query MyQuery {
  allIubendaDocument {
    nodes {
      documentId
      privacyPolicy
      cookiePolicy
      termsAndConditions
    }
  }
}

Use your privacy policy in your page:

<div dangerouslySetInnerHTML={{ __html: data.iubendaDocument.privacyPolicy }} />
© 2023 Gatsby, Inc.