From ef2a65c5441c303695729038681e4ccffbaa82f6 Mon Sep 17 00:00:00 2001 From: Charlotte Vermandel Date: Wed, 6 Apr 2022 17:44:48 +0200 Subject: [PATCH 1/3] Add code sample for landing page --- .code-samples.meilisearch.yaml | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .code-samples.meilisearch.yaml diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml new file mode 100644 index 00000000..cd30c170 --- /dev/null +++ b/.code-samples.meilisearch.yaml @@ -0,0 +1,47 @@ +landing_getting_started_1: |- + // in app.js + const search = instantsearch({ + indexName: 'movies', + searchClient: instantMeiliSearch( + 'http://localhost:7700', + 'searchKey' + ), + }) + + search.addWidgets([ + instantsearch.widgets.searchBox({ + container: '#searchbox', + }), + instantsearch.widgets.hits({ + container: '#hits', + templates: { + item: ` +
+
+ {{#helpers.highlight}}{ "attribute": "title" }{{/helpers.highlight}} +
+
+ `, + }, + }), + ]) + search.start() + + // in index.html + + + + + + + +
+ +
+
+ + + + + + From d57ee086dd4e373d9105bab37e6e27f2c0848944 Mon Sep 17 00:00:00 2001 From: Charlotte Vermandel Date: Thu, 7 Apr 2022 15:29:38 +0200 Subject: [PATCH 2/3] Update code sample in one file --- .code-samples.meilisearch.yaml | 77 +++++++++++++++------------------- 1 file changed, 33 insertions(+), 44 deletions(-) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index cd30c170..b7955ce7 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -1,47 +1,36 @@ landing_getting_started_1: |- - // in app.js - const search = instantsearch({ - indexName: 'movies', - searchClient: instantMeiliSearch( - 'http://localhost:7700', - 'searchKey' - ), - }) +
+ +
+
- search.addWidgets([ - instantsearch.widgets.searchBox({ - container: '#searchbox', - }), - instantsearch.widgets.hits({ - container: '#hits', - templates: { - item: ` -
-
- {{#helpers.highlight}}{ "attribute": "title" }{{/helpers.highlight}} -
-
- `, - }, - }), - ]) - search.start() - - // in index.html - - - - - + + + - - - - + search.addWidgets([ + instantsearch.widgets.searchBox({ + container: '#searchbox', + }), + instantsearch.widgets.hits({ + container: '#hits', + templates: { + item: ` +
+
+ {{#helpers.highlight}}{ "attribute": "title" }{{/helpers.highlight}} +
+
+ `, + }, + }), + ]) + search.start() + From a5c7441df6c46a98f36c6e686e6e9ca71a146a9a Mon Sep 17 00:00:00 2001 From: Charlotte Vermandel Date: Thu, 7 Apr 2022 15:40:16 +0200 Subject: [PATCH 3/3] Add body tag as a wrapper of the code sample --- .code-samples.meilisearch.yaml | 66 +++++++++++++++++----------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/.code-samples.meilisearch.yaml b/.code-samples.meilisearch.yaml index b7955ce7..23ea3232 100644 --- a/.code-samples.meilisearch.yaml +++ b/.code-samples.meilisearch.yaml @@ -1,36 +1,38 @@ landing_getting_started_1: |- -
- -
-
+ +
+ +
+
- - - + + + `, + }, + }), + ]) + search.start() + +