Skip to content

Commit fec8acd

Browse files
authored
Merge pull request #12083 from yigittopm/fix/dev-docs-prev-and-next-link
Fix/dev docs prev and next link
2 parents aecb21d + 18adf5c commit fec8acd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/DocsNav.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,16 @@ const DocsNav = ({ contentNotTranslated }: DocsNavProps) => {
128128
// Find index that matches current page
129129
let currentIndex = 0
130130
for (let i = 0; i < docsArray.length; i++) {
131-
if (asPath.indexOf(docsArray[i].to) > -1) {
131+
if (
132+
asPath.indexOf(docsArray[i].to) >= 0 &&
133+
asPath.length === docsArray[i].to.length
134+
) {
132135
currentIndex = i
133136
}
134137
}
135138

136139
// Extract previous and next doc based on current index +/- 1
137-
const previousDoc = currentIndex - 1 > 0 ? docsArray[currentIndex - 1] : null
140+
const previousDoc = currentIndex - 1 >= 0 ? docsArray[currentIndex - 1] : null
138141
const nextDoc =
139142
currentIndex + 1 < docsArray.length ? docsArray[currentIndex + 1] : null
140143

0 commit comments

Comments
 (0)