-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
define page title in sidebar from frontMatter.title
if page is not specified in _meta.json
#755
Conversation
🦋 Changeset detectedLatest commit: dc6d390 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
const title = extendedMeta.title || (type !== 'separator' && a.name) | ||
|
||
const getItem = (): Item => ({ | ||
...a, | ||
type, | ||
title: title || (type === 'separator' ? undefined : getTitle(a.name)), | ||
...(title && { title }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed title
package since we no need it here
Example: getTitle
will convert page name getting-started
to Getting-Started
so it's not really helpful
const meta = | ||
pageMap.find((item): item is MetaJsonFile => item.name === META_FILENAME) | ||
?.meta || {} | ||
const meta = pageMap.find( | ||
(item): item is MetaJsonFile => item.kind === 'Meta' | ||
)!.data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now _meta.json
fill be always exist in pageMap
and in fileMap
even it's not exist on disk, this _meta.json
will contain all pages with the title as item.frontMatter.title
or item.name
if (item.name === META_FILENAME) continue | ||
if (item.kind === 'Meta') continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I explicitly added kind
property, so TypeScript will be much smarter to understand of which kind of file is processed
38b939f
to
8e67249
Compare
…specified in `_meta.json` (shuding#755) * define page title in sidebar from `frontMatter.title` if page is not specified in `_meta.json` * fix typecheck * Update packages/nextra-theme-blog/src/utils/parent.ts * remove sortDate * `addPage` no longer need accept `frontMatter` (shuding#789) * update snapshots
fixes #747
use
item.frontMatter.title
eitheritem.name
as sidebar title if page is not specified in_meta.json