Skip to content

Commit

Permalink
feat: use 'sidebar_label' instead of 'title' in prev/next buttons (#1122
Browse files Browse the repository at this point in the history
)

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

* docs: update 'sidebar_label' description
  • Loading branch information
maxaggedon authored and endiliey committed Nov 22, 2018
1 parent a3ff990 commit 2df14fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
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

0 comments on commit 2df14fe

Please sign in to comment.