File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ First of all include the script
25
25
26
26
This will create a global object called ` JekyllSearch ` , on which you can invoke the ` init() ` function.
27
27
28
+ #Customize the plugin
29
+
28
30
If you want, you can customize several options of this plugin:
29
31
30
32
- ` searchInput ` (Element) the input field to listen on
@@ -36,6 +38,27 @@ If you want, you can customize several options of this plugin:
36
38
- ` fuzzy ` (Boolean) Turn on/off <a href =" #fuzzysearch " >fuzzy search</a >
37
39
- ` noResults ` (String) Text to display if nothing matched the search criteria
38
40
41
+ ---
42
+
43
+ You can pass the customized properties into an object when you invoke the init function, like this:
44
+
45
+ Let's say I want to apply JekyllSearch to a non-default input field (` .search ` ), e.g. ` #search-this-page ` .
46
+
47
+ I also changed the location of the JSON file, which is now ` site-search.json ` and I have a different <a href =" #template " >template</a >.
48
+
49
+ Plus I want to turn on <a href =" #fuzzysearch " >fuzzy search</a >:
50
+
51
+
52
+ ``` javascript
53
+ JekyllSearch .init ({
54
+ searchInput: document .getElementById (" search-this-page" ),
55
+ jsonFile: " site-search.json" ,
56
+ template: " <a href='{url}' title='{title}'>{title} <span class='tooltip'>{description}</span></a>" ,
57
+ fuzzy: true
58
+ });
59
+ ```
60
+
61
+
39
62
<h2 id =" template " >Template</h2 >
40
63
<h2 id =" fuzzysearch " >Fuzzy search</h2 >
41
64
You can’t perform that action at this time.
0 commit comments