Skip to content
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

feat: use 'sidebar_label' instead of 'title' in prev/next buttons #1122

Merged
merged 2 commits into from
Nov 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api-doc-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Documents use the following markdown header fields that are enclosed by a line `

`hide_title`: Whether to hide the title at the top of the doc.

`sidebar_label`: The text shown in the document sidebar for this document. If this field is not present, the document's `sidebar_label` will default to its `title`.
`sidebar_label`: The text shown in the document sidebar and in the next/previous button for this document. If this field is not present, the document's `sidebar_label` will default to its `title`.

For example:

Expand Down
12 changes: 12 additions & 0 deletions v1/lib/core/DocsLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,23 @@ class DocsLayout extends React.Component {
const hasOnPageNav = this.props.config.onPageNav === 'separate';

const previousTitle =
idx(i18n, [
'localized-strings',
'docs',
metadata.previous_id,
'sidebar_label',
]) ||
idx(i18n, ['localized-strings', 'docs', metadata.previous_id, 'title']) ||
idx(i18n, ['localized-strings', 'previous']) ||
metadata.previous_title ||
'Previous';
const nextTitle =
idx(i18n, [
'localized-strings',
'docs',
metadata.next_id,
'sidebar_label',
]) ||
idx(i18n, ['localized-strings', 'docs', metadata.next_id, 'title']) ||
idx(i18n, ['localized-strings', 'next']) ||
metadata.next_title ||
Expand Down