doc: make first sidebar items make sense

This commit is contained in:
KernelDeimos
2025-02-25 15:31:40 -05:00
parent 2a7bd2ad8d
commit eda376b6cc
2 changed files with 9 additions and 12 deletions

View File

@@ -133,8 +133,10 @@ const generate_sidebar = (documents) => {
}
// README.md always goes first
const isReadmeA = a.outputName.toLowerCase().includes('readme');
const isReadmeB = b.outputName.toLowerCase().includes('readme');
const isReadmeA = a.outputName.toLowerCase().includes('readme') ||
a.outputName.toLowerCase().includes('home');
const isReadmeB = b.outputName.toLowerCase().includes('readme') ||
b.outputName.toLowerCase().includes('home');
if (isReadmeA) return -1;
if (isReadmeB) return 1;
@@ -147,6 +149,9 @@ const generate_sidebar = (documents) => {
if ( document.outputName.split('-').slice(-1)[0].toLowerCase() === 'readme' ) {
title = 'Index (README.md)';
}
if ( document.outputName.split('-').slice(-1)[0].toLowerCase() === 'home' ) {
title = `Home`;
}
return `* [${title}](${document.outputName.replace('.md', '')})\n`;
};