mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-02 11:47:23 +02:00
refactor(v2): remove unused metadata for pages (#1694)
* refactor(v2): remove unused metadata for pages * changelog
This commit is contained in:
parent
1c59b5bc1c
commit
8b60e93bcb
2 changed files with 3 additions and 9 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
## 2.0.0-alpha.24
|
||||
|
||||
- Remove unused metadata for pages. This minimize number of http request & smaller bundle size.
|
||||
- Upgrade dependencies of css-loader from 2.x to 3.x. Css modules localIdentName hash now only use the last 4 characters instead of 8.
|
||||
- Fix broken markdown linking replacement for mdx files
|
||||
- Fix potential security vulnerability because we're exposing the directory structure of the host machine. Instead of absolute path, we use relative path from site directory. Resulting in shorter webpack chunk naming and smaller bundle size.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
const globby = require('globby');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const {encodePath, fileToPath, docuHash} = require('@docusaurus/utils');
|
||||
const {encodePath, fileToPath} = require('@docusaurus/utils');
|
||||
|
||||
const DEFAULT_OPTIONS = {
|
||||
path: 'src/pages', // Path to data on filesystem, relative to site dir.
|
||||
|
@ -63,22 +63,15 @@ module.exports = function(context, opts) {
|
|||
return;
|
||||
}
|
||||
|
||||
const {addRoute, createData} = actions;
|
||||
const {addRoute} = actions;
|
||||
|
||||
await Promise.all(
|
||||
content.map(async metadataItem => {
|
||||
const {permalink, source} = metadataItem;
|
||||
const metadataPath = await createData(
|
||||
`${docuHash(permalink)}.json`,
|
||||
JSON.stringify(metadataItem, null, 2),
|
||||
);
|
||||
addRoute({
|
||||
path: permalink,
|
||||
component: source,
|
||||
exact: true,
|
||||
modules: {
|
||||
metadata: metadataPath,
|
||||
},
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue