mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-22 05:27:00 +02:00
feat(preset-classic): exclude debug plugin routes from sitemap (#7122)
This commit is contained in:
parent
bfbc78e52a
commit
0963bff5e7
3 changed files with 22 additions and 10 deletions
|
@ -9,6 +9,8 @@ import type {LoadContext, Plugin} from '@docusaurus/types';
|
|||
import {docuHash, normalizeUrl, posixPath} from '@docusaurus/utils';
|
||||
import path from 'path';
|
||||
|
||||
export const routeBasePath = '__docusaurus/debug';
|
||||
|
||||
export default function pluginDebug({
|
||||
siteConfig: {baseUrl},
|
||||
generatedFilesDir,
|
||||
|
@ -40,37 +42,37 @@ export default function pluginDebug({
|
|||
|
||||
// Home is config (duplicate for now)
|
||||
addRoute({
|
||||
path: normalizeUrl([baseUrl, '__docusaurus/debug']),
|
||||
path: normalizeUrl([baseUrl, routeBasePath]),
|
||||
component: '@theme/DebugConfig',
|
||||
exact: true,
|
||||
});
|
||||
|
||||
addRoute({
|
||||
path: normalizeUrl([baseUrl, '__docusaurus/debug/config']),
|
||||
path: normalizeUrl([baseUrl, routeBasePath, 'config']),
|
||||
component: '@theme/DebugConfig',
|
||||
exact: true,
|
||||
});
|
||||
|
||||
addRoute({
|
||||
path: normalizeUrl([baseUrl, '__docusaurus/debug/metadata']),
|
||||
path: normalizeUrl([baseUrl, routeBasePath, 'metadata']),
|
||||
component: '@theme/DebugSiteMetadata',
|
||||
exact: true,
|
||||
});
|
||||
|
||||
addRoute({
|
||||
path: normalizeUrl([baseUrl, '__docusaurus/debug/registry']),
|
||||
path: normalizeUrl([baseUrl, routeBasePath, 'registry']),
|
||||
component: '@theme/DebugRegistry',
|
||||
exact: true,
|
||||
});
|
||||
|
||||
addRoute({
|
||||
path: normalizeUrl([baseUrl, '__docusaurus/debug/routes']),
|
||||
path: normalizeUrl([baseUrl, routeBasePath, 'routes']),
|
||||
component: '@theme/DebugRoutes',
|
||||
exact: true,
|
||||
});
|
||||
|
||||
addRoute({
|
||||
path: normalizeUrl([baseUrl, '__docusaurus/debug/content']),
|
||||
path: normalizeUrl([baseUrl, routeBasePath, 'content']),
|
||||
component: '@theme/DebugContent',
|
||||
exact: true,
|
||||
modules: {
|
||||
|
@ -79,7 +81,7 @@ export default function pluginDebug({
|
|||
});
|
||||
|
||||
addRoute({
|
||||
path: normalizeUrl([baseUrl, '__docusaurus/debug/globalData']),
|
||||
path: normalizeUrl([baseUrl, routeBasePath, 'globalData']),
|
||||
component: '@theme/DebugGlobalData',
|
||||
exact: true,
|
||||
});
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
|
||||
/// <reference types="@docusaurus/module-type-aliases" />
|
||||
|
||||
declare module '@docusaurus/plugin-debug' {
|
||||
export const routeBasePath: string;
|
||||
}
|
||||
|
||||
declare module '@theme/DebugConfig' {
|
||||
export default function DebugMetadata(): JSX.Element;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue