2.0.0 • Published 9 months ago

@kamen-kigu/docusaurus-plugin-structured-data v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

docusaurus-plugin-structured-data

Plugin to configure Structured Data for Docusaurus sites

How it works

This plugin will generate Structured Data for your Docusaurus site, compliant with schema.org.

The plugin will generate the following types of structured data, and include them in the <head> of your site using the JSON-LD format:

  • Organization - augmented using data from themeConfig.structuredData.organization
  • WebSite - augmented using data from themeConfig.structuredData.website
  • WebPage - dynamically generated for each page
  • BreadcrumbList - dynamically generated for each page

Installation

npm i @kamen-kigu/docusaurus-plugin-structured-data
# or
yarn add @kamen-kigu/docusaurus-plugin-structured-data

Setup

Add to plugins in docusaurus.config.js:

{
  plugins: [
    '@kamen-kigu/docusaurus-plugin-structured-data',
    ...
  ]
}

Update themeConfig in the docusaurus.config.js file:

{
  themeConfig: {
    structuredData: {
      excludedRoutes: [], // array of routes to exclude from structured data generation
      verbose: false, // print verbose output to console
      organization: {}, // Organization properties
      website: {}, // WebSite properties
      webpage: {
        datePublished: string, // default is the current date
        inLanguage: string, // default: en-US
      },
      breadcrumbLabelMap: {} // used to map breadcrumb labels to custom values
    },
  }
}

Config Example

structuredData: {
  excludedRoutes: [
    '/providers',
  ],  
  verbose: true,
  organization: {
    sameAs: [
      'https://github.com/yourusername',
    ],
    logo: {
      '@type': 'ImageObject',
      inLanguage: 'en-US',
      '@id': 'https://yoursite.com/#logo',
      url: 'https://yoursite.com/img/logo.png',
      contentUrl: 'https://yoursite.com/img/logo.png',
      width: 1440,
      height: 900,
    },
  },
  website: {
    inLanguage: 'en-US',
  },
  webpage: {
    inLanguage: 'en-US',
    datePublished: '2021-07-01',
  },
  breadcrumbLabelMap: {
    'docs': 'Documentation',
    'getting-started': 'Getting Started',
  }
}
2.0.0

9 months ago

1.3.3

10 months ago

1.3.211

10 months ago

1.3.21

10 months ago