hermes-agent/website/docusaurus.config.ts
Teknium 1d5deac346
fix(website): cross-locale doc links + drop empty ko locale (#31895)
The locale switcher appeared broken because hardcoded markdown links
(`](/docs/X)`) got double-prefixed by Docusaurus to `/docs/<locale>/docs/X`
(404) in non-English locales, and the MDX hero `<a href>` on the index
page escaped locale routing entirely.

Changes:
- Rewrite 922 `](/docs/X)` -> `](/X)` across 166 docs files (strip trailing
  .md too). Docusaurus prepends locale + baseUrl itself.
- docs/index.md -> index.mdx; hero "Get Started" anchor -> Docusaurus
  <Link> so it stays inside the active locale.
- Drop `ko` locale entirely from docusaurus.config.ts + delete i18n/ko/
  (4 stale auto-translated kanban pages, <2% coverage, misleading).

Verified `npm run build` succeeds for both en and zh-Hans; `build/zh-Hans/
index.html` has no /docs/zh-Hans/docs/... double-prefixed paths.

PR2 will translate the 335 English docs into i18n/zh-Hans/.
2026-05-24 23:16:20 -07:00

178 lines
4.9 KiB
TypeScript

import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
const config: Config = {
title: 'Hermes Agent',
tagline: 'The self-improving AI agent',
favicon: 'img/favicon.ico',
url: 'https://hermes-agent.nousresearch.com',
baseUrl: '/docs/',
organizationName: 'NousResearch',
projectName: 'hermes-agent',
onBrokenLinks: 'warn',
markdown: {
mermaid: true,
hooks: {
onBrokenMarkdownLinks: 'warn',
},
},
i18n: {
defaultLocale: 'en',
locales: ['en', 'zh-Hans'],
localeConfigs: {
en: {
label: 'English',
},
'zh-Hans': {
label: '简体中文',
htmlLang: 'zh-Hans',
},
},
},
themes: [
'@docusaurus/theme-mermaid',
[
require.resolve('@easyops-cn/docusaurus-search-local'),
/** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */
({
hashed: true,
language: ['en', 'zh'],
indexBlog: false,
docsRouteBasePath: '/',
// Disabled: appends ?_highlight=... to URLs (before the #anchor),
// which makes copy/pasted doc links ugly. Ctrl+F on the page is fine.
highlightSearchTermsOnTargetPage: false,
// Exclude the auto-generated per-skill catalog pages from search.
// There are hundreds of them and they dominate results for generic
// terms, drowning out the real user-guide / reference docs.
// The two human-written catalog indexes (reference/skills-catalog,
// reference/optional-skills-catalog) remain indexed.
//
// Note: ignoreFiles matches `route` (baseUrl stripped, no leading
// slash). With baseUrl '/docs/', `/docs/user-guide/skills/bundled/x`
// becomes 'user-guide/skills/bundled/x'.
ignoreFiles: [
/^user-guide\/skills\/bundled\//,
/^user-guide\/skills\/optional\//,
],
}),
],
],
presets: [
[
'classic',
{
docs: {
routeBasePath: '/', // Docs at the root of /docs/
sidebarPath: './sidebars.ts',
editUrl: 'https://github.com/NousResearch/hermes-agent/edit/main/website/',
},
blog: false,
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],
themeConfig: {
image: 'img/hermes-agent-banner.png',
colorMode: {
defaultMode: 'dark',
respectPrefersColorScheme: true,
},
docs: {
sidebar: {
hideable: true,
autoCollapseCategories: true,
},
},
navbar: {
title: 'Hermes Agent',
logo: {
alt: 'Hermes Agent',
src: 'img/logo.png',
},
items: [
{
type: 'docSidebar',
sidebarId: 'docs',
position: 'left',
label: 'Docs',
},
{
to: '/skills',
label: 'Skills',
position: 'left',
},
{
type: 'localeDropdown',
position: 'right',
},
{
href: 'https://hermes-agent.nousresearch.com',
label: 'Home',
position: 'right',
},
{
href: 'https://github.com/NousResearch/hermes-agent',
label: 'GitHub',
position: 'right',
},
{
href: 'https://discord.gg/NousResearch',
label: 'Discord',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{ label: 'Getting Started', to: '/getting-started/quickstart' },
{ label: 'User Guide', to: '/user-guide/cli' },
{ label: 'Developer Guide', to: '/developer-guide/architecture' },
{ label: 'Reference', to: '/reference/cli-commands' },
],
},
{
title: 'Community',
items: [
{ label: 'Discord', href: 'https://discord.gg/NousResearch' },
{ label: 'GitHub Discussions', href: 'https://github.com/NousResearch/hermes-agent/discussions' },
{ label: 'Skills Hub', href: 'https://agentskills.io' },
],
},
{
title: 'More',
items: [
{ label: 'GitHub', href: 'https://github.com/NousResearch/hermes-agent' },
{ label: 'Nous Research', href: 'https://nousresearch.com' },
],
},
],
copyright: `Built by <a href="https://nousresearch.com">Nous Research</a> · MIT License · ${new Date().getFullYear()}`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
additionalLanguages: ['bash', 'yaml', 'json', 'python', 'toml'],
},
mermaid: {
theme: {light: 'neutral', dark: 'dark'},
},
} satisfies Preset.ThemeConfig,
};
export default config;