mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 16:47:26 +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
|
id: bar
|
||||||
title: Bar
|
title: Bar
|
||||||
description: This is custom description
|
description: This is custom description
|
||||||
|
pagination_next: null
|
||||||
|
pagination_prev: null
|
||||||
---
|
---
|
||||||
|
|
||||||
# Remarkable
|
# Remarkable
|
||||||
|
|
|
@ -3,14 +3,8 @@
|
||||||
exports[`simple site custom pagination 1`] = `
|
exports[`simple site custom pagination 1`] = `
|
||||||
Array [
|
Array [
|
||||||
Array [
|
Array [
|
||||||
Object {
|
undefined,
|
||||||
"permalink": "/docs/rootTryToEscapeSlug",
|
undefined,
|
||||||
"title": "rootTryToEscapeSlug",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"permalink": "/docs/foo/bazSlug.html",
|
|
||||||
"title": "baz pagination_label",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
|
|
|
@ -127,15 +127,14 @@ Object {
|
||||||
"frontMatter": Object {
|
"frontMatter": Object {
|
||||||
"description": "This is custom description",
|
"description": "This is custom description",
|
||||||
"id": "bar",
|
"id": "bar",
|
||||||
|
"pagination_next": null,
|
||||||
|
"pagination_prev": null,
|
||||||
"title": "Bar",
|
"title": "Bar",
|
||||||
},
|
},
|
||||||
"id": "foo/bar",
|
"id": "foo/bar",
|
||||||
"lastUpdatedAt": undefined,
|
"lastUpdatedAt": undefined,
|
||||||
"lastUpdatedBy": undefined,
|
"lastUpdatedBy": undefined,
|
||||||
"next": Object {
|
"next": undefined,
|
||||||
"permalink": "/docs/foo/bazSlug.html",
|
|
||||||
"title": "baz pagination_label",
|
|
||||||
},
|
|
||||||
"permalink": "/docs/foo/bar",
|
"permalink": "/docs/foo/bar",
|
||||||
"previous": undefined,
|
"previous": undefined,
|
||||||
"sidebar": "docs",
|
"sidebar": "docs",
|
||||||
|
@ -341,13 +340,11 @@ Object {
|
||||||
\\"frontMatter\\": {
|
\\"frontMatter\\": {
|
||||||
\\"id\\": \\"bar\\",
|
\\"id\\": \\"bar\\",
|
||||||
\\"title\\": \\"Bar\\",
|
\\"title\\": \\"Bar\\",
|
||||||
\\"description\\": \\"This is custom description\\"
|
\\"description\\": \\"This is custom description\\",
|
||||||
|
\\"pagination_next\\": null,
|
||||||
|
\\"pagination_prev\\": null
|
||||||
},
|
},
|
||||||
\\"sidebar\\": \\"docs\\",
|
\\"sidebar\\": \\"docs\\"
|
||||||
\\"next\\": {
|
|
||||||
\\"title\\": \\"baz pagination_label\\",
|
|
||||||
\\"permalink\\": \\"/docs/foo/bazSlug.html\\"
|
|
||||||
}
|
|
||||||
}",
|
}",
|
||||||
"site-docs-foo-baz-md-a69.json": "{
|
"site-docs-foo-baz-md-a69.json": "{
|
||||||
\\"unversionedId\\": \\"foo/baz\\",
|
\\"unversionedId\\": \\"foo/baz\\",
|
||||||
|
|
|
@ -227,6 +227,8 @@ describe('simple site', () => {
|
||||||
description: 'This is custom description',
|
description: 'This is custom description',
|
||||||
id: 'bar',
|
id: 'bar',
|
||||||
title: 'Bar',
|
title: 'Bar',
|
||||||
|
pagination_next: null,
|
||||||
|
pagination_prev: null,
|
||||||
},
|
},
|
||||||
tags: [],
|
tags: [],
|
||||||
});
|
});
|
||||||
|
|
|
@ -319,12 +319,14 @@ export function addDocNavigation(
|
||||||
return toDocNavigationLink(navDoc);
|
return toDocNavigationLink(navDoc);
|
||||||
};
|
};
|
||||||
|
|
||||||
const previous: DocNavLink | undefined = doc.frontMatter.pagination_prev
|
const previous =
|
||||||
? toNavigationLinkByDocId(doc.frontMatter.pagination_prev, 'prev')
|
doc.frontMatter.pagination_prev !== undefined
|
||||||
: toNavigationLink(navigation.previous, docsById);
|
? toNavigationLinkByDocId(doc.frontMatter.pagination_prev, 'prev')
|
||||||
const next: DocNavLink | undefined = doc.frontMatter.pagination_next
|
: toNavigationLink(navigation.previous, docsById);
|
||||||
? toNavigationLinkByDocId(doc.frontMatter.pagination_next, 'next')
|
const next =
|
||||||
: toNavigationLink(navigation.next, docsById);
|
doc.frontMatter.pagination_next !== undefined
|
||||||
|
? toNavigationLinkByDocId(doc.frontMatter.pagination_next, 'next')
|
||||||
|
: toNavigationLink(navigation.next, docsById);
|
||||||
|
|
||||||
return {...doc, sidebar: navigation.sidebarName, previous, next};
|
return {...doc, sidebar: navigation.sidebarName, previous, next};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue