mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-02 02:42:41 +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
|
@ -41,7 +41,7 @@ class DocusaurusPluginContentBlog {
|
|||
}
|
||||
|
||||
// Fetches blog contents and returns metadata for the contents.
|
||||
async loadContents() {
|
||||
async loadContent() {
|
||||
const {pageCount, include, routeBasePath} = this.options;
|
||||
const {env, siteConfig} = this.context;
|
||||
const blogDir = this.contentPath;
|
||||
|
@ -109,10 +109,10 @@ class DocusaurusPluginContentBlog {
|
|||
return blogMetadata;
|
||||
}
|
||||
|
||||
async generateRoutes({metadata, actions}) {
|
||||
async contentLoaded({content, actions}) {
|
||||
const {blogPageComponent, blogPostComponent} = this.options;
|
||||
const {addRoute} = actions;
|
||||
metadata.forEach(metadataItem => {
|
||||
content.forEach(metadataItem => {
|
||||
const {isBlogPage, permalink} = metadataItem;
|
||||
if (isBlogPage) {
|
||||
addRoute({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue