Skip to content

Commit

Permalink
docs(blog-only): add warning and improve error log (#9839)
Browse files Browse the repository at this point in the history
  • Loading branch information
OzakIOne authored Feb 9, 2024
1 parent 34297bc commit a296d72
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/docusaurus-plugin-content-docs/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,20 @@ export const useAllDocsData = (): {[pluginId: string]: GlobalPluginData} =>
}
| undefined) ?? StableEmptyObject;

export const useDocsData = (pluginId: string | undefined): GlobalPluginData =>
usePluginData('docusaurus-plugin-content-docs', pluginId, {
failfast: true,
}) as GlobalPluginData;
export const useDocsData = (pluginId: string | undefined): GlobalPluginData => {
try {
return usePluginData('docusaurus-plugin-content-docs', pluginId, {
failfast: true,
}) as GlobalPluginData;
} catch (error) {
throw new Error(
`You are using a feature of the Docusaurus docs plugin, but this plugin does not seem to be enabled${
pluginId === 'Default' ? '' : ` (pluginId=${pluginId}`
}`,
{cause: error as Error},
);
}
};

// TODO this feature should be provided by docusaurus core
export function useActivePlugin(
Expand Down
6 changes: 6 additions & 0 deletions website/docs/blog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,12 @@ Don't forget to delete the existing homepage at `./src/pages/index.js` or else t

:::

:::warning

If you disable the docs plugin, don't forget to delete references to the docs plugin elsewhere in your configuration file. Notably, make sure to remove the docs-related navbar items.

:::

:::tip

There's also a "Docs-only mode" for those who only want to use the docs. Read [Docs-only mode](./guides/docs/docs-introduction.mdx) for detailed instructions or a more elaborate explanation of `routeBasePath`.
Expand Down

0 comments on commit a296d72

Please sign in to comment.