Replace hardcoded text with strings stored in _data
file
This commit is contained in:
parent
7e8700df75
commit
19f6d32745
4 changed files with 16 additions and 10 deletions
|
@ -40,6 +40,8 @@ en: &DEFAULT_EN
|
||||||
comment_success_msg : "Thanks for your comment! It will show on the site once it has been approved."
|
comment_success_msg : "Thanks for your comment! It will show on the site once it has been approved."
|
||||||
comment_error_msg : "Sorry, there was an error with your submission. Please make sure all required fields have been completed and try again."
|
comment_error_msg : "Sorry, there was an error with your submission. Please make sure all required fields have been completed and try again."
|
||||||
loading_label : "Loading..."
|
loading_label : "Loading..."
|
||||||
|
search_placeholder_text : "Enter your search term..."
|
||||||
|
results_found : "Result(s) found"
|
||||||
en-US:
|
en-US:
|
||||||
<<: *DEFAULT_EN
|
<<: *DEFAULT_EN
|
||||||
en-CA:
|
en-CA:
|
||||||
|
|
|
@ -21,10 +21,12 @@ layout: default
|
||||||
{% endunless %}
|
{% endunless %}
|
||||||
|
|
||||||
{{ content }}
|
{{ content }}
|
||||||
|
|
||||||
<input placeholder="Search..." type="search" id="search" class="search-input">
|
|
||||||
<div id="results"></div>
|
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<input placeholder="{{ site.data.ui-text[site.locale].search_placeholder_text | default: "Enter your search term..." }}" type="search" id="search" class="search-input">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div id="results"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
|
---
|
||||||
|
|
||||||
---
|
|
||||||
var idx = lunr(function () {
|
var idx = lunr(function () {
|
||||||
this.field('title', {boost: 10})
|
this.field('title', {boost: 10})
|
||||||
this.field('excerpt')
|
this.field('excerpt')
|
||||||
|
@ -58,26 +58,26 @@ $(document).ready(function() {
|
||||||
var query = $(this).val();
|
var query = $(this).val();
|
||||||
var result = idx.search(query);
|
var result = idx.search(query);
|
||||||
resultdiv.empty();
|
resultdiv.empty();
|
||||||
resultdiv.prepend('<p>'+result.length+' Result(s) found</p>');
|
resultdiv.prepend('<p>'+result.length+' {{ site.data.ui-text[site.locale].results_found | default: "Result(s) found" }}</p>');
|
||||||
for (var item in result) {
|
for (var item in result) {
|
||||||
var ref = result[item].ref;
|
var ref = result[item].ref;
|
||||||
if(store[ref].teaser){
|
if(store[ref].teaser){
|
||||||
var searchitem =
|
var searchitem =
|
||||||
'<div>'+
|
'<div class="list__item">'+
|
||||||
'<article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork">'+
|
'<article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork">'+
|
||||||
'<div class="archive__item-teaser">'+
|
|
||||||
'<img src="'+store[ref].teaser+'" alt="">'+
|
|
||||||
'</div>'+
|
|
||||||
'<h2 class="archive__item-title" itemprop="headline">'+
|
'<h2 class="archive__item-title" itemprop="headline">'+
|
||||||
'<a href="'+store[ref].url+'" rel="permalink">'+store[ref].title+'</a>'+
|
'<a href="'+store[ref].url+'" rel="permalink">'+store[ref].title+'</a>'+
|
||||||
'</h2>'+
|
'</h2>'+
|
||||||
|
'<div class="archive__item-teaser">'+
|
||||||
|
'<img src="'+store[ref].teaser+'" alt="">'+
|
||||||
|
'</div>'+
|
||||||
'<p class="archive__item-excerpt" itemprop="description">'+store[ref].excerpt+'</p>'+
|
'<p class="archive__item-excerpt" itemprop="description">'+store[ref].excerpt+'</p>'+
|
||||||
'</article>'+
|
'</article>'+
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
var searchitem =
|
var searchitem =
|
||||||
'<div>'+
|
'<div class="list__item">'+
|
||||||
'<article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork">'+
|
'<article class="archive__item" itemscope itemtype="http://schema.org/CreativeWork">'+
|
||||||
'<h2 class="archive__item-title" itemprop="headline">'+
|
'<h2 class="archive__item-title" itemprop="headline">'+
|
||||||
'<a href="'+store[ref].url+'" rel="permalink">'+store[ref].title+'</a>'+
|
'<a href="'+store[ref].url+'" rel="permalink">'+store[ref].title+'</a>'+
|
||||||
|
|
|
@ -40,6 +40,8 @@ en: &DEFAULT_EN
|
||||||
comment_success_msg : "Thanks for your comment! It will show on the site once it has been approved."
|
comment_success_msg : "Thanks for your comment! It will show on the site once it has been approved."
|
||||||
comment_error_msg : "Sorry, there was an error with your submission. Please make sure all required fields have been completed and try again."
|
comment_error_msg : "Sorry, there was an error with your submission. Please make sure all required fields have been completed and try again."
|
||||||
loading_label : "Loading..."
|
loading_label : "Loading..."
|
||||||
|
search_placeholder_text : "Enter your search term..."
|
||||||
|
results_found : "Result(s) found"
|
||||||
en-US:
|
en-US:
|
||||||
<<: *DEFAULT_EN
|
<<: *DEFAULT_EN
|
||||||
en-CA:
|
en-CA:
|
||||||
|
|
Loading…
Add table
Reference in a new issue