diff --git a/README.md b/README.md index aa6599f..d7a3eec 100644 --- a/README.md +++ b/README.md @@ -61,11 +61,11 @@ in a sub-folder) and see the search results for "foobar" listed. ## The search form -How to design your search form is up to you, but here's a very rudimentary example which you can put either in a -template file or on a specific page. +How to design your search form is up to you, but here's a very rudimentary example which you can put in a +template file: ```html -
+ @@ -74,12 +74,14 @@ template file or on a specific page. // Intercept form submit and go to the search results page directly, avoiding a redirect document.getElementById('search_form').addEventListener('submit', function (e) { var search_terms = document.getElementById('search_input').value; - location.href = '/search/' + encodeURIComponent(search_terms); + location.href = '{{ "search"|link }}/' + encodeURIComponent(search_terms); e.preventDefault(); }); ``` +If you want to put it in a content file, you'll have to adjust the template variables accordingly, ie. instead of `{{ "search"|link }}` you'd use something like `%base_url%?search`. + ## Configuration options You can exclude certain pages from being included in the search results by using the configuration option `search_excludes`.