mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
Check whether a previous/next doc actually exists (#226)
* Check whether a previous/next doc actually exists * Use reasonable defaults * Remove extraneous space
This commit is contained in:
parent
fe11556ae7
commit
19e6cc7ecc
1 changed files with 12 additions and 2 deletions
|
@ -315,10 +315,20 @@ function generateMetadataDocs() {
|
|||
// 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[metadatas[metadata].previous]) {
|
||||
metadatas[metadata].previous_title =
|
||||
metadatas[metadatas[metadata].previous].title;
|
||||
} else {
|
||||
metadatas[metadata].previous_title = "Previous";
|
||||
}
|
||||
}
|
||||
if (metadatas[metadata].next) {
|
||||
metadatas[metadata].next_title = metadatas[metadatas[metadata].next].title;
|
||||
if (metadatas[metadatas[metadata].next]) {
|
||||
metadatas[metadata].next_title =
|
||||
metadatas[metadatas[metadata].next].title;
|
||||
} else {
|
||||
metadatas[metadata].next_title = "Next";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue