mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 12:47:14 +02:00
Merge pull request #177 from JoelMarcey/show-next-doc
Show doc names instead of "previous" and "next"
This commit is contained in:
commit
4d23bf76ff
2 changed files with 25 additions and 4 deletions
|
@ -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>
|
||||
)}
|
||||
|
|
|
@ -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" +
|
||||
|
|
Loading…
Add table
Reference in a new issue