Merge pull request #177 from JoelMarcey/show-next-doc

Show doc names instead of "previous" and "next"
This commit is contained in:
Eric Nakagawa 2017-10-24 19:19:38 -07:00 committed by GitHub
commit 4d23bf76ff
2 changed files with 25 additions and 4 deletions

View file

@ -63,8 +63,13 @@ class DocsLayout extends React.Component {
{i18n
? translation[this.props.metadata.language][
"localized-strings"
]["previous"] || "Previous"
: "Previous"}
][metadata.previous_id] ||
translation[this.props.metadata.language][
"localized-strings"
]["previous"] ||
"Previous"
: metadata.previous_title || "Previous"
}
</a>
)}
{metadata.next_id && (
@ -74,8 +79,13 @@ class DocsLayout extends React.Component {
{i18n
? translation[this.props.metadata.language][
"localized-strings"
]["next"] || "Next"
: "Next"}{" "}
][metadata.next_id] ||
translation[this.props.metadata.language][
"localized-strings"
]["next"] ||
"Next"
: metadata.next_title || "Next"
}{" "}
</a>
)}

View file

@ -289,6 +289,17 @@ function generateMetadataDocs() {
metadatas[metadata.id] = metadata;
});
// Get the titles of the previous and next ids so that we can use them in
// navigation buttons in DocsLayout.js
Object.keys(metadatas).forEach(function(metadata) {
if (metadatas[metadata].previous) {
metadatas[metadata].previous_title = metadatas[metadatas[metadata].previous].title;
}
if (metadatas[metadata].next) {
metadatas[metadata].next_title = metadatas[metadatas[metadata].next].title;
}
});
fs.writeFileSync(
__dirname + "/../core/metadata.js",
"/**\n" +