Is it possible to pull siteConfig when extending the Docusaurus cli? #11191
-
I'm working on a llms.txt plugin, and the plugin has the option to run during postBuild or to disable it and manually invoke it with a cli command: Additionally, one of the options i have is to convert relative paths to full urls (if enabled) to match the stripe recommendations. This said, is there a way to grab the context/siteConfig when invoking a docusaurus command? So for what I've done is grab the context on |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, the plugin receives the site context as a parameter that you can use in any lifecycle method: export default function (context, options) {
return {
name: 'docusaurus-plugin',
extendCli(cli) {
cli
.command('llms-txt')
.description('Generates a llms.txt file')
.action(() => {
console.log(context.siteConfig);
});
},
};
} We may be interested in having such a plugin in the core repo. However, I'm not yet convinced of the usefulness of this weird file format that everybody produces, but not sure any crawler consumes it. Related:
Regarding the implementation, I think it would be more reliable to use the It's not clear to me how such a plugin would decide to create markdown headings, how things get grouped and ordered in the final output. Relying on reading the file system and fancy heuristics, trying to reimplement the docs sidebar and other similar things is not going to be the most reliable, and it would probably be better if Docusaurus somehow associated page "breadcrumb" metadata to each route in the |
Beta Was this translation helpful? Give feedback.
Yes, the plugin receives the site context as a parameter that you can use in any lifecycle method:
We may be interested in having such a plugin in the core repo.
However, I'm not yet convinced of the usefulness of this weird file format that everybody produces, but not sure any crawler consumes it.
Related: