|
4 | 4 |
|
5 | 5 | <script type="text/javascript"> |
6 | 6 | let siteLang = window.location.pathname.startsWith("/zh/") ? "zh" : "en"; |
7 | | - if (!["cloudwego.cn", "www.cloudwego.cn"].includes(location.host)) { |
8 | | - docsearch({ |
9 | | - appId: "V7I042F992", |
10 | | - apiKey: "8380a7ac88106841cb43fb000fa2edb4", |
11 | | - indexName: "cloudwego", |
12 | | - container: "#docsearch", |
13 | | - searchParameters: { |
14 | | - hitsPerPage: 5, |
15 | | - facetFilters: [`lang:${siteLang}`], |
16 | | - }, |
17 | | - //debug: true, // Set debug to true if you want to inspect the modal |
18 | | - //resultsFooterComponent({ state }) { |
19 | | - // return { |
20 | | - // // The HTML `tag` |
21 | | - // type: 'a', |
22 | | - // ref: undefined, |
23 | | - // constructor: undefined, |
24 | | - // key: state.query, |
25 | | - // // Its props |
26 | | - // props: { |
27 | | - // href: '', |
28 | | - // target: '_blank', |
29 | | - // onClick: (event) => { |
30 | | - // console.log(event); |
31 | | - // }, |
32 | | - // // Raw text rendered in the HTML element |
33 | | - // children: `${state.context.nbHits} hits found!`, |
34 | | - // }, |
35 | | - // __v: null, |
36 | | - // }; |
37 | | - //}, |
38 | | - }); |
39 | | - } |
| 7 | + docsearch({ |
| 8 | + appId: "V7I042F992", |
| 9 | + apiKey: "8380a7ac88106841cb43fb000fa2edb4", |
| 10 | + indexName: "cloudwego", |
| 11 | + container: "#docsearch", |
| 12 | + searchParameters: { |
| 13 | + hitsPerPage: 5, |
| 14 | + facetFilters: [`lang:${siteLang}`], |
| 15 | + }, |
| 16 | + transformItems(items) { |
| 17 | + return items.map((item) => { |
| 18 | + return { |
| 19 | + ...item, |
| 20 | + url: item.url |
| 21 | + .replace("www.cloudwego.io", location.host) |
| 22 | + .replace("https:", location.protocol), |
| 23 | + }; |
| 24 | + }); |
| 25 | + }, |
| 26 | + //debug: true, // Set debug to true if you want to inspect the modal |
| 27 | + //resultsFooterComponent({ state }) { |
| 28 | + // return { |
| 29 | + // // The HTML `tag` |
| 30 | + // type: 'a', |
| 31 | + // ref: undefined, |
| 32 | + // constructor: undefined, |
| 33 | + // key: state.query, |
| 34 | + // // Its props |
| 35 | + // props: { |
| 36 | + // href: '', |
| 37 | + // target: '_blank', |
| 38 | + // onClick: (event) => { |
| 39 | + // console.log(event); |
| 40 | + // }, |
| 41 | + // // Raw text rendered in the HTML element |
| 42 | + // children: `${state.context.nbHits} hits found!`, |
| 43 | + // }, |
| 44 | + // __v: null, |
| 45 | + // }; |
| 46 | + //}, |
| 47 | + }); |
40 | 48 | </script> |
41 | 49 |
|
42 | 50 | {{ end }} |
|
0 commit comments