Skip to content

Commit

Permalink
doc: move internal pages to a separate section (langchain-ai#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivan-sean authored Feb 17, 2023
1 parent f02042d commit 76d5352
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,39 @@ const config = {
docs: {
sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/hwchase17/langchainjs/',
async sidebarItemsGenerator({
defaultSidebarItemsGenerator,
...args
}) {
const allInternal = [];
const filterInternal = (items) => {
return items.filter(item => {
const isInternal = item.label?.includes("internal");
if (isInternal) {
allInternal.push(item);
}
return !isInternal;
}).map((item) => {
const { items, ...rest } = item;
if (items && Array.isArray(items)) {
return { ...item, items: filterInternal(item.items) }
}
return item;
});
}
const sidebarItems = await defaultSidebarItemsGenerator(args);
const filtered = filterInternal(sidebarItems)
if (allInternal.length > 0) {
return [...filtered, {
type: "category",
label: "Internal",
collapsible: true,
collapsed: true,
items: allInternal
}];
}
return filtered;
},
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
Expand Down

0 comments on commit 76d5352

Please sign in to comment.