Skip to content

Is it possible to pull siteConfig when extending the Docusaurus cli? #11191

Answered by slorber
Devon-White asked this question in General
Discussion options

You must be logged in to vote

This said, is there a way to grab the context/siteConfig when invoking a docusaurus command?

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:

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Devon-White
Comment options

Answer selected by Devon-White
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants