Skip to content

Commit d57ee08

Browse files
committed
Update code sample in one file
1 parent ef2a65c commit d57ee08

File tree

1 file changed

+33
-44
lines changed

1 file changed

+33
-44
lines changed

.code-samples.meilisearch.yaml

Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,36 @@
11
landing_getting_started_1: |-
2-
// in app.js
3-
const search = instantsearch({
4-
indexName: 'movies',
5-
searchClient: instantMeiliSearch(
6-
'http://localhost:7700',
7-
'searchKey'
8-
),
9-
})
2+
<div>
3+
<div id="searchbox"></div>
4+
<div id="hits"></div>
5+
</div>
106
11-
search.addWidgets([
12-
instantsearch.widgets.searchBox({
13-
container: '#searchbox',
14-
}),
15-
instantsearch.widgets.hits({
16-
container: '#hits',
17-
templates: {
18-
item: `
19-
<div>
20-
<div class="hit-name">
21-
{{#helpers.highlight}}{ "attribute": "title" }{{/helpers.highlight}}
22-
</div>
23-
</div>
24-
`,
25-
},
26-
}),
27-
])
28-
search.start()
29-
30-
// in index.html
31-
<!DOCTYPE html>
32-
<html lang="en">
33-
<head>
34-
<meta charset="utf-8" />
35-
</head>
7+
<script src="https://cdn.jsdelivr.net/npm/@meilisearch/instant-meilisearch/dist/instant-meilisearch.umd.min.js"></script>
8+
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
9+
<script>
10+
const search = instantsearch({
11+
indexName: 'movies',
12+
searchClient: instantMeiliSearch(
13+
'http://localhost:7700',
14+
'searchKey'
15+
),
16+
})
3617
37-
<body>
38-
<div>
39-
<div id="searchbox"></div>
40-
<div id="hits"></div>
41-
</div>
42-
43-
<script src="https://cdn.jsdelivr.net/npm/@meilisearch/instant-meilisearch/dist/instant-meilisearch.umd.min.js"></script>
44-
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
45-
<script src="./app.js"></script>
46-
</body>
47-
</html>
18+
search.addWidgets([
19+
instantsearch.widgets.searchBox({
20+
container: '#searchbox',
21+
}),
22+
instantsearch.widgets.hits({
23+
container: '#hits',
24+
templates: {
25+
item: `
26+
<div>
27+
<div class="hit-name">
28+
{{#helpers.highlight}}{ "attribute": "title" }{{/helpers.highlight}}
29+
</div>
30+
</div>
31+
`,
32+
},
33+
}),
34+
])
35+
search.start()
36+
</script>

0 commit comments

Comments
 (0)