Merge branch 'master' of https://github.com/mmistakes/minimal-mistakes
This commit is contained in:
commit
9b17ac9856
5 changed files with 51 additions and 3 deletions
|
@ -60,13 +60,15 @@ atom_feed:
|
||||||
path : # blank (default) uses feed.xml
|
path : # blank (default) uses feed.xml
|
||||||
search : # true, false (default)
|
search : # true, false (default)
|
||||||
search_full_content : # true, false (default)
|
search_full_content : # true, false (default)
|
||||||
search_provider : # lunr (default), algolia
|
search_provider : # lunr (default), algolia, google
|
||||||
algolia:
|
algolia:
|
||||||
application_id : # YOUR_APPLICATION_ID
|
application_id : # YOUR_APPLICATION_ID
|
||||||
index_name : # YOUR_INDEX_NAME
|
index_name : # YOUR_INDEX_NAME
|
||||||
search_only_api_key : # YOUR_SEARCH_ONLY_API_KEY
|
search_only_api_key : # YOUR_SEARCH_ONLY_API_KEY
|
||||||
powered_by : # true (default), false
|
powered_by : # true (default), false
|
||||||
|
google:
|
||||||
|
search_engine_id : # YOUR_SEARCH_ENGINE_ID
|
||||||
|
instant_search : # false (default), true
|
||||||
# SEO Related
|
# SEO Related
|
||||||
google_site_verification :
|
google_site_verification :
|
||||||
bing_site_verification :
|
bing_site_verification :
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
{%- case search_provider -%}
|
{%- case search_provider -%}
|
||||||
{%- when "lunr" -%}
|
{%- when "lunr" -%}
|
||||||
{% include search/lunr-search-scripts.html %}
|
{% include search/lunr-search-scripts.html %}
|
||||||
|
{%- when "google" -%}
|
||||||
|
{% include search/google-search-scripts.html %}
|
||||||
{%- when "algolia" -%}
|
{%- when "algolia" -%}
|
||||||
{% include search/algolia-search-scripts.html %}
|
{% include search/algolia-search-scripts.html %}
|
||||||
{%- endcase -%}
|
{%- endcase -%}
|
||||||
|
|
30
_includes/search/google-search-scripts.html
Normal file
30
_includes/search/google-search-scripts.html
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var cx = '{{ site.google.search_engine_id }}';
|
||||||
|
var gcse = document.createElement('script');
|
||||||
|
gcse.type = 'text/javascript';
|
||||||
|
gcse.async = true;
|
||||||
|
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
|
||||||
|
var s = document.getElementsByTagName('script')[0];
|
||||||
|
s.parentNode.insertBefore(gcse, s);
|
||||||
|
})();
|
||||||
|
|
||||||
|
function googleCustomSearchExecute() {
|
||||||
|
var input = document.getElementById('cse-search-input-box-id');
|
||||||
|
var element = google.search.cse.element.getElement('searchresults-only0');
|
||||||
|
if (input.value == '') {
|
||||||
|
element.clearAllResults();
|
||||||
|
} else {
|
||||||
|
element.execute(input.value);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
{% if site.google.instant_search %}
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('input#cse-search-input-box-id').on('keyup', function () {
|
||||||
|
googleCustomSearchExecute();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
{% endif %}
|
||||||
|
</script>
|
|
@ -4,6 +4,13 @@
|
||||||
{%- when "lunr" -%}
|
{%- when "lunr" -%}
|
||||||
<input type="text" id="search" class="search-input" tabindex="-1" placeholder="{{ site.data.ui-text[site.locale].search_placeholder_text | default: 'Enter your search term...' }}" />
|
<input type="text" id="search" class="search-input" tabindex="-1" placeholder="{{ site.data.ui-text[site.locale].search_placeholder_text | default: 'Enter your search term...' }}" />
|
||||||
<div id="results" class="results"></div>
|
<div id="results" class="results"></div>
|
||||||
|
{%- when "google" -%}
|
||||||
|
<form onsubmit="return executeQuery();" id="cse-search-box-form-id">
|
||||||
|
<input type="text" id="cse-search-input-box-id" class="search-input" tabindex="-1" placeholder="{{ site.data.ui-text[site.locale].search_placeholder_text | default: 'Enter your search term...' }}" />
|
||||||
|
</form>
|
||||||
|
<div id="results" class="results">
|
||||||
|
<gcse:searchresults-only></gcse:searchresults-only>
|
||||||
|
</div>
|
||||||
{%- when "algolia" -%}
|
{%- when "algolia" -%}
|
||||||
<div class="search-searchbar"></div>
|
<div class="search-searchbar"></div>
|
||||||
<div class="search-hits"></div>
|
<div class="search-hits"></div>
|
||||||
|
|
|
@ -27,6 +27,13 @@ layout: default
|
||||||
{%- when "lunr" -%}
|
{%- when "lunr" -%}
|
||||||
<input type="text" id="search" class="search-input" tabindex="-1" placeholder="{{ site.data.ui-text[site.locale].search_placeholder_text | default: 'Enter your search term...' }}" />
|
<input type="text" id="search" class="search-input" tabindex="-1" placeholder="{{ site.data.ui-text[site.locale].search_placeholder_text | default: 'Enter your search term...' }}" />
|
||||||
<div id="results" class="results"></div>
|
<div id="results" class="results"></div>
|
||||||
|
{%- when "google" -%}
|
||||||
|
<form onsubmit="return executeQuery();" id="cse-search-box-form-id">
|
||||||
|
<input type="text" id="cse-search-input-box-id" class="search-input" tabindex="-1" placeholder="{{ site.data.ui-text[site.locale].search_placeholder_text | default: 'Enter your search term...' }}" />
|
||||||
|
</form>
|
||||||
|
<div id="results" class="results">
|
||||||
|
<gcse:searchresults-only></gcse:searchresults-only>
|
||||||
|
</div>
|
||||||
{%- when "algolia" -%}
|
{%- when "algolia" -%}
|
||||||
<div class="search-searchbar"></div>
|
<div class="search-searchbar"></div>
|
||||||
<div class="search-hits"></div>
|
<div class="search-hits"></div>
|
||||||
|
|
Loading…
Reference in a new issue