Skip to content

Commit defdaad

Browse files
authored
chore: hide search by domain (#815)
Signed-off-by: rogerogers <[email protected]>
1 parent 056e58b commit defdaad

File tree

1 file changed

+34
-32
lines changed

1 file changed

+34
-32
lines changed

layouts/partials/hooks/body-end.html

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,40 @@
33
<script src="/js/docsearch.js"></script>
44

55
<script type="text/javascript">
6-
let siteLang = window.location.pathname.startsWith('/zh/') ? 'zh' : 'en';
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-
//debug: true, // Set debug to true if you want to inspect the modal
17-
//resultsFooterComponent({ state }) {
18-
// return {
19-
// // The HTML `tag`
20-
// type: 'a',
21-
// ref: undefined,
22-
// constructor: undefined,
23-
// key: state.query,
24-
// // Its props
25-
// props: {
26-
// href: '',
27-
// target: '_blank',
28-
// onClick: (event) => {
29-
// console.log(event);
30-
// },
31-
// // Raw text rendered in the HTML element
32-
// children: `${state.context.nbHits} hits found!`,
33-
// },
34-
// __v: null,
35-
// };
36-
//},
37-
});
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+
}
3840
</script>
3941

4042
{{ end }}

0 commit comments

Comments
 (0)