Skip to content

Is it possible to generate sidebars programatically? #10582

Closed Answered by slorber
ilg-ul asked this question in Q&A
Discussion options

You must be logged in to vote

The list of tools is not in such a json, it is in an array of names. (well, now it is, because I manually redefined it as a duplicate)

An array of name or a JSON, it's the same, you can import both from any js or ts file.

The advice remain: import your tools in sidebars.js

You can keep a function if you want, or export a static object, or rename the file as json. It doesn't matter. What matters is that sidebars.js use the data you already define instead of duplicating it.

but the question remains the same, where do I call this function, and how do I pass the result to Docusaurus.

The answer remains the same,

If it's a function, you import it in sidebars.js and call it there, take the …

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@ilg-ul
Comment options

@slorber
Comment options

@ilg-ul
Comment options

@slorber
Comment options

Answer selected by ilg-ul
@ilg-ul
Comment options

@slorber
Comment options

@ilg-ul
Comment options

@slorber
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants