@@ -21,7 +21,9 @@ import SideBar from '#theme/Sidebar';
2121 * @param {{ metadata: import('../../types').SerializedMetadata, headings: Array, readingTime: string, children: import('preact').ComponentChildren } } props
2222 */
2323export default ( { metadata, headings, readingTime, children } ) => {
24- const crossLinkItems = navigation . sidebar . flatMap ( ( { items } ) => items ) ;
24+ const crossLinkItems = navigation . showCrossLinks
25+ ? ( navigation . sidebar ?. flatMap ( ( { items } ) => items ) ?? [ ] )
26+ : [ ] ;
2527
2628 const currentItem = crossLinkItems . findIndex (
2729 ( { link } ) => link === metadata . path
@@ -43,25 +45,27 @@ export default ({ metadata, headings, readingTime, children }) => {
4345 < TableOfContents headings = { headings } summaryTitle = "On this page" />
4446 < br />
4547 < main > { children } </ main >
46- < div className = { styles . crossLinks } >
47- { ( previousCrossLink && (
48- < CrossLink
49- type = "previous"
50- label = "Previous"
51- text = { previousCrossLink . label }
52- link = { previousCrossLink . link }
53- />
54- ) ) || < div /> }
48+ { ( previousCrossLink || nextCrossLink ) && (
49+ < div className = { styles . crossLinks } >
50+ { ( previousCrossLink && (
51+ < CrossLink
52+ type = "previous"
53+ label = "Previous"
54+ text = { previousCrossLink . label }
55+ link = { previousCrossLink . link }
56+ />
57+ ) ) || < div /> }
5558
56- { nextCrossLink && (
57- < CrossLink
58- type = "next"
59- label = "Next"
60- text = { nextCrossLink . label }
61- link = { nextCrossLink . link }
62- />
63- ) }
64- </ div >
59+ { nextCrossLink && (
60+ < CrossLink
61+ type = "next"
62+ label = "Next"
63+ text = { nextCrossLink . label }
64+ link = { nextCrossLink . link }
65+ />
66+ ) }
67+ </ div >
68+ ) }
6569 </ div >
6670 < MetaBar
6771 metadata = { metadata }
0 commit comments