mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-04 11:52:39 +02:00
refactor(v2): plugins lifecycle (#1299)
* refactor(v2): plugins lifecycle * dont allow duplicate plugin & fix typo
This commit is contained in:
parent
3a7a253db7
commit
73b89658cc
10 changed files with 127 additions and 136 deletions
|
@ -31,7 +31,7 @@ class DocusaurusPluginContentPages {
|
|||
return 'docusaurus-plugin-content-pages';
|
||||
}
|
||||
|
||||
async loadContents() {
|
||||
async loadContent() {
|
||||
const {include} = this.options;
|
||||
const {env, siteConfig} = this.context;
|
||||
const pagesDir = this.contentPath;
|
||||
|
@ -88,11 +88,11 @@ class DocusaurusPluginContentPages {
|
|||
return pagesMetadatas;
|
||||
}
|
||||
|
||||
async generateRoutes({metadata, actions}) {
|
||||
async contentLoaded({content, actions}) {
|
||||
const {component} = this.options;
|
||||
const {addRoute} = actions;
|
||||
|
||||
metadata.forEach(metadataItem => {
|
||||
content.forEach(metadataItem => {
|
||||
const {permalink, source} = metadataItem;
|
||||
addRoute({
|
||||
path: permalink,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue