mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-14 09:37:37 +02:00
feat(v2): create docusaurus-content-blog plugin draft
This commit is contained in:
parent
211e04f409
commit
e5b7daef33
8 changed files with 95 additions and 41 deletions
|
@ -5,6 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const _ = require('lodash');
|
||||
const path = require('path');
|
||||
const staticSiteGenerator = require('static-site-generator-webpack-plugin');
|
||||
const webpackNiceLog = require('webpack-nicelog');
|
||||
|
@ -21,13 +22,18 @@ module.exports = function createServerConfig(props) {
|
|||
// Workaround for Webpack 4 Bug (https://github.com/webpack/webpack/issues/6522)
|
||||
config.output.globalObject('this');
|
||||
|
||||
const {siteConfig, blogMetadatas, docsMetadatas, pagesMetadatas} = props;
|
||||
const {siteConfig, docsMetadatas, pagesMetadatas, contentsStore} = props;
|
||||
|
||||
// Static site generator webpack plugin.
|
||||
const docsFlatMetadatas = Object.values(docsMetadatas);
|
||||
const paths = [...blogMetadatas, ...docsFlatMetadatas, ...pagesMetadatas].map(
|
||||
data => data.permalink,
|
||||
);
|
||||
|
||||
// TODO: Generalize this into blog plugin.
|
||||
const blogPermalinks = _.get(contentsStore, ['blog', 'contents'], []);
|
||||
const paths = [
|
||||
...blogPermalinks,
|
||||
...docsFlatMetadatas,
|
||||
...pagesMetadatas,
|
||||
].map(data => data.permalink);
|
||||
config.plugin('siteGenerator').use(staticSiteGenerator, [
|
||||
{
|
||||
entry: 'main',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue