Skip to content

Commit 9794e9e

Browse files
authored
Fix frontMatter.sidebarTitle didn't affect without frontMatter.title set (#3478)
* aa * aa
1 parent 5d37b3d commit 9794e9e

File tree

8 files changed

+40
-30
lines changed

8 files changed

+40
-30
lines changed

.changeset/ninety-news-behave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'nextra': patch
3+
---
4+
5+
update package version range for `@theguild/remark-mermaid` to be at least `^0.1.3` https://github.com/nextauthjs/next-auth/pull/12029#discussion_r1801785960

.changeset/silver-poems-turn.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'nextra': patch
3+
'nextra-theme-docs': patch
4+
---
5+
6+
Fix `frontMatter.sidebarTitle` didn't affect without `frontMatter.title` set
7+
8+
now priority for sidebar title is:
9+
10+
1. `title` property from `_meta` file
11+
1. `frontMatter.sidebarTitle`
12+
1. `frontMatter.title`
13+
1. formatted with [Title](https://title.sh) based on filename

docs/pages/docs/_meta.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default {
2-
index: 'Introduction',
2+
index: '',
33
guide: '',
44
'-- Themes': {
55
type: 'separator',

docs/pages/docs/docs-theme/page-configuration.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import { Screenshot } from 'components/screenshot'
2+
import { Video } from 'components/video'
3+
import { Callout, FileTree } from 'nextra/components'
4+
import menuImage from 'public/assets/docs/menu.png'
5+
16
# Page Configuration
27

38
In Nextra, the site and page structure can be configured via the co-located
@@ -7,11 +12,6 @@ customize it further.
712
Those configurations affect the overall layout of the theme, especially the
813
navigation bar and the sidebar.
914

10-
import { Screenshot } from 'components/screenshot'
11-
import { Video } from 'components/video'
12-
import { Callout, FileTree } from 'nextra/components'
13-
import menuImage from 'public/assets/docs/menu.png'
14-
1515
<Callout>
1616
Read more about Nextra's `_meta.js` files
1717
[here](/docs/guide/organize-files#_metajs).
@@ -45,7 +45,7 @@ export default {
4545
<Callout>
4646
If any routes are not listed in the `_meta.js` file, they will be appended to
4747
the end of the sidebar and sorted alphabetically, and the title will be
48-
formatted with [Title](https://title.sh).
48+
formatted with [Title](https://title.sh) based on filename.
4949
</Callout>
5050

5151
## Folders

docs/pages/docs/index.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
---
2+
sidebarTitle: Introduction
3+
---
4+
5+
import { Cards } from 'nextra/components'
6+
17
# Introduction
28

39
**Nextra** is a framework on top of Next.js, that lets you build content focused
@@ -6,8 +12,6 @@ Markdown-based content with ease.
612

713
## Quick Start
814

9-
import { Cards } from 'nextra/components'
10-
1115
To start using Nextra, you need to select a theme first:
1216

1317
<Cards num={2}>

packages/nextra/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
"@mdx-js/react": "^3.0.0",
134134
"@napi-rs/simple-git": "^0.1.9",
135135
"@shikijs/twoslash": "^1.0.0",
136-
"@theguild/remark-mermaid": "^0.1.2",
136+
"@theguild/remark-mermaid": "^0.1.3",
137137
"@theguild/remark-npm2yarn": "^0.3.2",
138138
"better-react-mathjax": "^2.0.3",
139139
"clsx": "^2.0.0",

packages/nextra/src/server/page-map.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ async function collectFiles({
121121
const content = await fs.readFile(filePath, 'utf8')
122122
const { data } = grayMatter(content)
123123
if (!data.title) {
124-
data.sidebarTitle = pageTitleFromFilename(name)
124+
data.sidebarTitle ||= pageTitleFromFilename(name)
125125
}
126126

127127
return {

pnpm-lock.yaml

Lines changed: 7 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)