Skip to content

equinix-labs/docusaurus-plugin-localizejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

@equinix-labs/docusaurus-plugin-localizejs

A Docusaurus plugin that injects the Localize.js script and initializes it on every page of your Docusaurus site.

Prerequisites

  • A Localize account and project key from localizejs.com
  • A Docusaurus v2 or v3 site

Installation

npm install @equinix-labs/docusaurus-plugin-localizejs

Usage

Add the plugin to your docusaurus.config.js:

// docusaurus.config.js
module.exports = {
  plugins: [
    [
      '@equinix-labs/docusaurus-plugin-localizejs',
      {
        key: 'YOUR_LOCALIZE_PROJECT_KEY',
        settings: {
          // optional Localize initialization settings
          // see https://developers.localizejs.com/reference/introduction
        },
      },
    ],
  ],
};

Options

Option Type Required Description
key string Yes Your Localize project key
settings object No Additional Localize initialization options passed to Localize.initialize()

How it works

The plugin uses the Docusaurus injectHtmlTags lifecycle method to inject the following into the <head> of every page:

  1. The Localize CDN script (https://global.localizecdn.com/localize.js)
  2. The Localize stub script (prevents errors if the CDN script has not yet loaded)
  3. A Localize.initialize() call with your project key and any additional settings

References

License

MIT

About

Docusaurus plugin for adding Localize to all pages

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •