mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 07:37:19 +02:00
fix(v2): remove buggy routesLoaded + deprecate routesLoaded lifecycle (#3141)
* remove bad deletion of docs / if conflicting with a page * deprecate routesLoaded
This commit is contained in:
parent
ac757e9dff
commit
d25d4b08f6
4 changed files with 10 additions and 30 deletions
|
@ -68,9 +68,6 @@ export default function pluginContentDocs(
|
|||
context: LoadContext,
|
||||
options: PluginOptions,
|
||||
): Plugin<LoadedContent | null, typeof PluginOptionSchema> {
|
||||
const homePageDocsRoutePath =
|
||||
options.routeBasePath === '' ? '/' : options.routeBasePath;
|
||||
|
||||
if (options.admonitions) {
|
||||
options.remarkPlugins = options.remarkPlugins.concat([
|
||||
[admonitions, options.admonitions],
|
||||
|
@ -487,23 +484,6 @@ Available document ids=
|
|||
);
|
||||
},
|
||||
|
||||
async routesLoaded(routes) {
|
||||
const homeDocsRoutes = routes.filter(
|
||||
(routeConfig) => routeConfig.path === homePageDocsRoutePath,
|
||||
);
|
||||
|
||||
// Remove the route for docs home page if there is a page with the same path (i.e. docs).
|
||||
if (homeDocsRoutes.length > 1) {
|
||||
const docsHomePageRouteIndex = routes.findIndex(
|
||||
(route) =>
|
||||
route.component === options.docLayoutComponent &&
|
||||
route.path === homePageDocsRoutePath,
|
||||
);
|
||||
|
||||
delete routes[docsHomePageRouteIndex!];
|
||||
}
|
||||
},
|
||||
|
||||
configureWebpack(_config, isServer, utils) {
|
||||
const {getBabelLoader, getCacheLoader} = utils;
|
||||
const {rehypePlugins, remarkPlugins} = options;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue