From 5238bb4cadb2231d833f5299afbc2bcdc2d56b02 Mon Sep 17 00:00:00 2001 From: Thomas Knickman Date: Tue, 18 Oct 2022 12:27:56 -0400 Subject: [PATCH] feat(docs): support logoLink config option (#905) --- .changeset/olive-otters-float.md | 5 ++++ .../src/pages/themes/docs/configuration.mdx | 30 +++++++++++++++++++ .../src/components/navbar.tsx | 19 +++++++----- packages/nextra-theme-docs/src/constants.tsx | 1 + packages/nextra-theme-docs/src/types.ts | 1 + 5 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 .changeset/olive-otters-float.md diff --git a/.changeset/olive-otters-float.md b/.changeset/olive-otters-float.md new file mode 100644 index 0000000000..206afbf9b1 --- /dev/null +++ b/.changeset/olive-otters-float.md @@ -0,0 +1,5 @@ +--- +"nextra-theme-docs": patch +--- + +feat(docs): support logoLink config option diff --git a/examples/docs/src/pages/themes/docs/configuration.mdx b/examples/docs/src/pages/themes/docs/configuration.mdx index d8d96fad9f..48983144ad 100644 --- a/examples/docs/src/pages/themes/docs/configuration.mdx +++ b/examples/docs/src/pages/themes/docs/configuration.mdx @@ -355,6 +355,36 @@ export default { } ``` +## `logoLink` + +Enable automaticaly linking the logo to root, or provide a custom url. + +**Type:** `string` | `boolean` + +**Default:** `true` (links to `/` by default) + +**Example:** + +```js filename="theme.config.js" +/** + * @type {import('nextra-theme-docs').DocsThemeConfig} + */ +export default { + logoLink: '/about' +} +``` + +Or to disable the logo link: + +```js filename="theme.config.js" +/** + * @type {import('nextra-theme-docs').DocsThemeConfig} + */ +export default { + logoLink: false +} +``` + ## `head` The head that should be inserted into the html document. diff --git a/packages/nextra-theme-docs/src/components/navbar.tsx b/packages/nextra-theme-docs/src/components/navbar.tsx index c1850dbb72..1b1c5bffa1 100644 --- a/packages/nextra-theme-docs/src/components/navbar.tsx +++ b/packages/nextra-theme-docs/src/components/navbar.tsx @@ -94,13 +94,18 @@ export function Navbar({ flatDirectories, items }: NavBarProps): ReactElement { )} />