2.0.0 • Published 9 months ago
@kamen-kigu/docusaurus-plugin-structured-data v2.0.0
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 fromthemeConfig.structuredData.organizationWebSite- augmented using data fromthemeConfig.structuredData.websiteWebPage- dynamically generated for each pageBreadcrumbList- dynamically generated for each page
Installation
npm i @kamen-kigu/docusaurus-plugin-structured-data
# or
yarn add @kamen-kigu/docusaurus-plugin-structured-dataSetup
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',
}
}