mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-05 21:27:24 +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
|
{i18n
|
||||||
? translation[this.props.metadata.language][
|
? translation[this.props.metadata.language][
|
||||||
"localized-strings"
|
"localized-strings"
|
||||||
]["previous"] || "Previous"
|
][metadata.previous_id] ||
|
||||||
: "Previous"}
|
translation[this.props.metadata.language][
|
||||||
|
"localized-strings"
|
||||||
|
]["previous"] ||
|
||||||
|
"Previous"
|
||||||
|
: metadata.previous_title || "Previous"
|
||||||
|
}
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
{metadata.next_id && (
|
{metadata.next_id && (
|
||||||
|
@ -74,8 +79,13 @@ class DocsLayout extends React.Component {
|
||||||
{i18n
|
{i18n
|
||||||
? translation[this.props.metadata.language][
|
? translation[this.props.metadata.language][
|
||||||
"localized-strings"
|
"localized-strings"
|
||||||
]["next"] || "Next"
|
][metadata.next_id] ||
|
||||||
: "Next"}{" "}
|
translation[this.props.metadata.language][
|
||||||
|
"localized-strings"
|
||||||
|
]["next"] ||
|
||||||
|
"Next"
|
||||||
|
: metadata.next_title || "Next"
|
||||||
|
}{" "}
|
||||||
→
|
→
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -289,6 +289,17 @@ function generateMetadataDocs() {
|
||||||
metadatas[metadata.id] = metadata;
|
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(
|
fs.writeFileSync(
|
||||||
__dirname + "/../core/metadata.js",
|
__dirname + "/../core/metadata.js",
|
||||||
"/**\n" +
|
"/**\n" +
|
||||||
|
|
Loading…
Add table
Reference in a new issue