refactor(v2): plugins lifecycle (#1299)

* refactor(v2): plugins lifecycle

* dont allow duplicate plugin & fix typo
This commit is contained in:
Endilie Yacop Sucipto 2019-03-24 06:08:36 +07:00 committed by Yangshun Tay
parent 3a7a253db7
commit 73b89658cc
10 changed files with 127 additions and 136 deletions

View file

@ -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,