mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 08:37:25 +02:00
fix(content-docs): restore behavior when pagination front matter is null (#6124)
* fix(content-docs): restore behavior when pagination front matter is null * update snaps
This commit is contained in:
parent
8f18cbbeb3
commit
a5d2815154
5 changed files with 21 additions and 24 deletions
|
@ -2,6 +2,8 @@
|
|||
id: bar
|
||||
title: Bar
|
||||
description: This is custom description
|
||||
pagination_next: null
|
||||
pagination_prev: null
|
||||
---
|
||||
|
||||
# Remarkable
|
||||
|
|
|
@ -3,14 +3,8 @@
|
|||
exports[`simple site custom pagination 1`] = `
|
||||
Array [
|
||||
Array [
|
||||
Object {
|
||||
"permalink": "/docs/rootTryToEscapeSlug",
|
||||
"title": "rootTryToEscapeSlug",
|
||||
},
|
||||
Object {
|
||||
"permalink": "/docs/foo/bazSlug.html",
|
||||
"title": "baz pagination_label",
|
||||
},
|
||||
undefined,
|
||||
undefined,
|
||||
],
|
||||
Array [
|
||||
Object {
|
||||
|
|
|
@ -127,15 +127,14 @@ Object {
|
|||
"frontMatter": Object {
|
||||
"description": "This is custom description",
|
||||
"id": "bar",
|
||||
"pagination_next": null,
|
||||
"pagination_prev": null,
|
||||
"title": "Bar",
|
||||
},
|
||||
"id": "foo/bar",
|
||||
"lastUpdatedAt": undefined,
|
||||
"lastUpdatedBy": undefined,
|
||||
"next": Object {
|
||||
"permalink": "/docs/foo/bazSlug.html",
|
||||
"title": "baz pagination_label",
|
||||
},
|
||||
"next": undefined,
|
||||
"permalink": "/docs/foo/bar",
|
||||
"previous": undefined,
|
||||
"sidebar": "docs",
|
||||
|
@ -341,13 +340,11 @@ Object {
|
|||
\\"frontMatter\\": {
|
||||
\\"id\\": \\"bar\\",
|
||||
\\"title\\": \\"Bar\\",
|
||||
\\"description\\": \\"This is custom description\\"
|
||||
\\"description\\": \\"This is custom description\\",
|
||||
\\"pagination_next\\": null,
|
||||
\\"pagination_prev\\": null
|
||||
},
|
||||
\\"sidebar\\": \\"docs\\",
|
||||
\\"next\\": {
|
||||
\\"title\\": \\"baz pagination_label\\",
|
||||
\\"permalink\\": \\"/docs/foo/bazSlug.html\\"
|
||||
}
|
||||
\\"sidebar\\": \\"docs\\"
|
||||
}",
|
||||
"site-docs-foo-baz-md-a69.json": "{
|
||||
\\"unversionedId\\": \\"foo/baz\\",
|
||||
|
|
|
@ -227,6 +227,8 @@ describe('simple site', () => {
|
|||
description: 'This is custom description',
|
||||
id: 'bar',
|
||||
title: 'Bar',
|
||||
pagination_next: null,
|
||||
pagination_prev: null,
|
||||
},
|
||||
tags: [],
|
||||
});
|
||||
|
|
|
@ -319,10 +319,12 @@ export function addDocNavigation(
|
|||
return toDocNavigationLink(navDoc);
|
||||
};
|
||||
|
||||
const previous: DocNavLink | undefined = doc.frontMatter.pagination_prev
|
||||
const previous =
|
||||
doc.frontMatter.pagination_prev !== undefined
|
||||
? toNavigationLinkByDocId(doc.frontMatter.pagination_prev, 'prev')
|
||||
: toNavigationLink(navigation.previous, docsById);
|
||||
const next: DocNavLink | undefined = doc.frontMatter.pagination_next
|
||||
const next =
|
||||
doc.frontMatter.pagination_next !== undefined
|
||||
? toNavigationLinkByDocId(doc.frontMatter.pagination_next, 'next')
|
||||
: toNavigationLink(navigation.next, docsById);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue