File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ export default {
53
53
54
54
const max = 5
55
55
const { pages } = this .$site
56
+ const localePath = this .$basepath
56
57
const matches = item => (
57
58
item .title &&
58
59
item .title .toLowerCase ().indexOf (query) > - 1
@@ -61,6 +62,10 @@ export default {
61
62
for (let i = 0 ; i < pages .length ; i++ ) {
62
63
if (res .length >= max) break
63
64
const p = pages[i]
65
+ // filter out results that do not match current locale
66
+ if (this .getPageLocalePath (p) !== localePath) {
67
+ continue
68
+ }
64
69
if (matches (p)) {
65
70
res .push (p)
66
71
} else if (p .headers ) {
@@ -86,8 +91,15 @@ export default {
86
91
}
87
92
},
88
93
methods: {
89
- onClick () {
90
- console .log (' clicked' )
94
+ getPageLocalePath (page ) {
95
+ const { langs } = this .$site
96
+ for (let i = 0 ; i < langs .length ; i++ ) {
97
+ const localePath = langs[i].path
98
+ if (localePath !== ' /' && page .path .indexOf (localePath) === 0 ) {
99
+ return langs[i].path
100
+ }
101
+ }
102
+ return ' /'
91
103
},
92
104
onUp () {
93
105
if (this .showSuggestions ) {
You can’t perform that action at this time.
0 commit comments