A Docusaurus plugin that injects the Localize.js script and initializes it on every page of your Docusaurus site.
- A Localize account and project key from localizejs.com
- A Docusaurus v2 or v3 site
npm install @equinix-labs/docusaurus-plugin-localizejsAdd 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
},
},
],
],
};| Option | Type | Required | Description |
|---|---|---|---|
key |
string |
Yes | Your Localize project key |
settings |
object |
No | Additional Localize initialization options passed to Localize.initialize() |
The plugin uses the Docusaurus injectHtmlTags lifecycle method to inject the following into the <head> of every page:
- The Localize CDN script (
https://global.localizecdn.com/localize.js) - The Localize stub script (prevents errors if the CDN script has not yet loaded)
- A
Localize.initialize()call with your project key and any additional settings