-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multi-instance support with plugin-sitemap #5877
Comments
it looks like docs and blog got the multi-instance support in #3204, but not the sitemap plugin. |
The error is being triggered in if (pluginInstancesWithId.length !== 1) {
throw new Error(`Plugin "${pluginName}" is used ${pluginInstancesWithId.length} times with id ${pluginId}.\nTo use the same plugin multiple times on a Docusaurus site, you need to assign a unique id to each plugin instance.`);
} 🤔 how do you auto-assign IDs to a plugin you define only once by including it in |
Found a reference to the lifecycle in exports.sortConfig = sortConfig;
async function loadPlugins({ pluginConfigs, context, }) {
// 1. Plugin Lifecycle - Initialization/Constructor.
const plugins = (0, init_1.default)({
pluginConfigs,
context,
});
// 2. Plugin Lifecycle - loadContent.
// Currently plugins run lifecycle methods in parallel and are not order-dependent.
// We could change this in future if there are plugins which need to
// run in certain order or depend on others for data. I actually want to run a single instance of the plugin ... why do I get the message about multiple instances? |
Quick look at:
The output follows:
The two instances are the same. The next step is finding out how do they get added to the list of plugins? Then, eliminate the duplication. |
The plugin normalization happens in |
Disabled the
For the first int
and the second is:
Note: The |
Two issues:
docusaurus/packages/docusaurus-plugin-sitemap/src/index.ts Lines 30 to 34 in cbcaa52
Added debug and the |
Kept the |
Thanks for investing your own time to look into this:D I'm not sure I understand what you are looking for. Are you trying to use multiple sitemap plugins? For what purpose? Beware that |
@Josh-Cena , I am trying to generate a single However, if a website has multiple
I think it does not happen by default. |
WDYM, does not happen by default? https://docusaurus.io/docs/next/presets#docusauruspreset-classic |
That's false. A plugin never summons or even knows about another plugin. Your problem is that you did't put the configuration in the right place. I'll see what we can do to help users prevent these kinds of mistakes as they happen often |
@Josh-Cena , you are correct! 👍 I need to set
|
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
Failed to generate sitemap for multi-instance setup.
Steps to reproduce
Have multi-instance setup, then add the following plugin level config:
Expected behavior
Sitemap generated for both instances of docs in multi-instance setup.
Actual behavior
Get error:
Your environment
2.0.0-beta.9
Reproducible demo
No response
Self-service
The text was updated successfully, but these errors were encountered: