llama-stack-mirror/docs/docusaurus.config.ts
Alexey Rybak b6a5bccadf
docs: api separation (#3630)
# What does this PR do?

First step towards cleaning up the API reference section of the docs.

- Separates API reference into 3 sections: stable (`v1`), experimental (`v1alpha` and `v1beta`), and deprecated (`deprecated=True`)
- Each section is accessible via the dropdown menu and `docs/api-overview`

<img width="1237" height="321" alt="Screenshot 2025-09-30 at 5 47 30 PM" src="https://github.com/user-attachments/assets/fe0e498c-b066-46ed-a48e-4739d3b6724c" />

<img width="860" height="510" alt="Screenshot 2025-09-30 at 5 47 49 PM" src="https://github.com/user-attachments/assets/a92a8d8c-94bf-42d5-9f5b-b47bb2b14f9c" />

- Deprecated APIs: Added styling to the sidebar, and a notice on the endpoint pages

<img width="867" height="428" alt="Screenshot 2025-09-30 at 5 47 43 PM" src="https://github.com/user-attachments/assets/9e6e050d-c782-461b-8084-5ff6496d7bd9" />

Closes #3628

TODO in follow-up PRs:

- Add the ability to annotate API groups with supplementary content  (so we can have longer descriptions of complex APIs like Responses)
- Clean up docstrings to show API endpoints (or short semantic titles) in the sidebar

## Test Plan

- Local testing
- Made sure API conformance test still passes
2025-10-01 10:13:31 -07:00

260 lines
6.8 KiB
TypeScript

// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
import type * as Preset from "@docusaurus/preset-classic";
import type { Config } from "@docusaurus/types";
import type * as Plugin from "@docusaurus/types/src/plugin";
import type * as OpenApiPlugin from "docusaurus-plugin-openapi-docs";
const config: Config = {
title: 'Llama Stack',
tagline: 'The open-source framework for building generative AI applications',
url: 'https://llamastack.github.io',
baseUrl: '/',
onBrokenLinks: "warn",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.ico",
// GitHub pages deployment config.
organizationName: 'reluctantfuturist',
projectName: 'llama-stack',
trailingSlash: false,
presets: [
[
"classic",
{
docs: {
sidebarPath: require.resolve("./sidebars.ts"),
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: 'https://github.com/meta-llama/llama-stack/tree/main/docs/',
docItemComponent: "@theme/ApiItem", // Derived from docusaurus-theme-openapi
},
blog: false,
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
} satisfies Preset.Options,
],
],
themeConfig: {
image: 'img/llama-stack.png',
navbar: {
title: 'Llama Stack',
logo: {
alt: 'Llama Stack Logo',
src: 'img/llama-stack-logo.png',
},
items: [
{
type: 'docSidebar',
sidebarId: 'tutorialSidebar',
position: 'left',
label: 'Docs',
},
{
type: 'dropdown',
label: 'API Reference',
position: 'left',
to: '/docs/api-overview',
items: [
{
type: 'docSidebar',
sidebarId: 'stableApiSidebar',
label: '🟢 Stable APIs',
},
{
type: 'docSidebar',
sidebarId: 'experimentalApiSidebar',
label: '🟡 Experimental APIs',
},
{
type: 'docSidebar',
sidebarId: 'deprecatedApiSidebar',
label: '🔴 Deprecated APIs',
},
],
},
{
href: 'https://github.com/llamastack/llama-stack',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Getting Started',
to: '/docs/getting_started/quickstart',
},
{
label: 'Concepts',
to: '/docs/concepts',
},
{
label: 'API Reference',
to: '/docs/api-overview',
},
],
},
{
title: 'Community',
items: [
{
label: 'Discord',
href: 'https://discord.gg/llama-stack',
},
{
label: 'GitHub Discussions',
href: 'https://github.com/llamastack/llama-stack/discussions',
},
{
label: 'Issues',
href: 'https://github.com/llamastack/llama-stack/issues',
},
],
},
{
title: 'More',
items: [
{
label: 'GitHub',
href: 'https://github.com/llamastack/llama-stack',
},
{
label: 'PyPI',
href: 'https://pypi.org/project/llama-stack/',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Meta Platforms, Inc. Built with Docusaurus.`,
},
prism: {
additionalLanguages: [
'ruby',
'csharp',
'php',
'java',
'powershell',
'json',
'bash',
'python',
'yaml',
],
},
docs: {
sidebar: {
hideable: true,
},
},
// Language tabs for API documentation
languageTabs: [
{
highlight: "python",
language: "python",
logoClass: "python",
},
{
highlight: "bash",
language: "curl",
logoClass: "curl",
},
{
highlight: "javascript",
language: "nodejs",
logoClass: "nodejs",
},
{
highlight: "java",
language: "java",
logoClass: "java",
},
],
} satisfies Preset.ThemeConfig,
plugins: [
[
"docusaurus-plugin-openapi-docs",
{
id: "openapi",
docsPluginId: "classic",
config: {
stable: {
specPath: "static/llama-stack-spec.yaml",
outputDir: "docs/api",
downloadUrl: "https://raw.githubusercontent.com/meta-llama/llama-stack/main/docs/static/llama-stack-spec.yaml",
sidebarOptions: {
groupPathsBy: "tag",
categoryLinkSource: "tag",
},
} satisfies OpenApiPlugin.Options,
experimental: {
specPath: "static/experimental-llama-stack-spec.yaml",
outputDir: "docs/api-experimental",
downloadUrl: "https://raw.githubusercontent.com/meta-llama/llama-stack/main/docs/static/experimental-llama-stack-spec.yaml",
sidebarOptions: {
groupPathsBy: "tag",
categoryLinkSource: "tag",
},
} satisfies OpenApiPlugin.Options,
deprecated: {
specPath: "static/deprecated-llama-stack-spec.yaml",
outputDir: "docs/api-deprecated",
downloadUrl: "https://raw.githubusercontent.com/meta-llama/llama-stack/main/docs/static/deprecated-llama-stack-spec.yaml",
sidebarOptions: {
groupPathsBy: "tag",
categoryLinkSource: "tag",
},
} satisfies OpenApiPlugin.Options,
} satisfies Plugin.PluginOptions,
},
],
],
themes: [
"docusaurus-theme-openapi-docs",
[
require.resolve("@easyops-cn/docusaurus-search-local"),
{
// Optimization for production
hashed: true,
// Language settings
language: ["en"],
// Content indexing settings
indexDocs: true,
indexBlog: false, // No blog in Llama Stack
indexPages: true,
// Route configuration
docsRouteBasePath: '/docs',
// Search behavior optimization for technical docs
searchResultLimits: 8,
searchResultContextMaxLength: 50,
explicitSearchResultPath: true,
// User experience enhancements
searchBarShortcut: true,
searchBarShortcutHint: true,
searchBarPosition: "right",
// Performance optimizations
ignoreFiles: [
"node_modules/**/*",
],
},
],
],
};
export default config;