diff options
-rw-r--r-- | assets/js/search.js | 8 | ||||
-rw-r--r-- | i18n/en-shaw.yml | 19 | ||||
-rw-r--r-- | i18n/en.yml | 19 | ||||
-rw-r--r-- | layouts/_default/search.html | 13 | ||||
-rw-r--r-- | layouts/partials/pagination.html | 4 |
5 files changed, 40 insertions, 23 deletions
diff --git a/assets/js/search.js b/assets/js/search.js index 2dc147e..ab2256b 100644 --- a/assets/js/search.js +++ b/assets/js/search.js @@ -63,19 +63,15 @@ function renderResults(results) { resultBox.appendChild(resultEntry(value.item, key)) }) } else { - resultBox.innerHTML = - "<p class=\"bg-washed-red pa3 dark-red f4 fw6 tc br2 b--light-red ba\">No matches found</p>" + resultBox.innerHTML = document.getElementById("no-match").innerHTML } } -addEventListener("load", function (){ +addEventListener("load", function () { let searchQuery = getUrlParameter(location.search, "q") if (searchQuery) { document.getElementById("search-query").value = searchQuery executeSearch(searchQuery).then(renderResults) - } else { - document.getElementById("search-results").innerHTML = - "<p class=\"pa3 f4 fw6 tc\">Please enter a word or phrase above</p>" } } ) diff --git a/i18n/en-shaw.yml b/i18n/en-shaw.yml index 278709d..c42630e 100644 --- a/i18n/en-shaw.yml +++ b/i18n/en-shaw.yml @@ -14,15 +14,22 @@ tag: talk: one: ๐๐ท๐ other: ๐๐ท๐๐ +match_found: + one: "๐ฅ๐จ๐ ๐๐ฌ๐ฏ๐" + other: "๐ฅ๐จ๐๐ฉ๐ ๐๐ฌ๐ฏ๐" # Rest -next: ๐ฏ๐ง๐๐๐ -prev: ๐๐ฎ๐ฐ๐๐พ๐ -see_all: "๐๐ฐ ๐ท๐ค" -about: ๐ฉ๐๐ฌ๐ -recent_pages: ๐๐ฑ๐ก๐ฉ๐ ๐ฎ๐ฐ๐๐ฉ๐ฏ๐๐ค๐ฆ ๐ง๐๐ฆ๐๐ฉ๐ _blank: " " -translations: ๐๐ฎ๐จ๐ฏ๐๐ค๐ฑ๐๐ฉ๐ฏ๐ +about: ๐ฉ๐๐ฌ๐ author_by: ๐๐ฒ minute_read: "๐ฅ๐ฐ๐ฏ ๐ฎ๐ฐ๐" +next: "๐ฏ๐ง๐๐๐" +no_match_found: "๐ฏ๐ด ๐ฅ๐จ๐ ๐๐ฌ๐ฏ๐" +prev: ๐๐ฎ๐ฐ๐๐พ๐ +recent_pages: ๐๐ฑ๐ก๐ฉ๐ ๐ฎ๐ฐ๐๐ฉ๐ฏ๐๐ค๐ฆ ๐ง๐๐ฆ๐๐ฉ๐ rss_follow: "๐๐ช๐ค๐ด {{ .section }} ๐ณ๐๐๐ฑ๐๐ ๐๐ฒ๐ฉ RSS ๐๐ฐ๐" +search: ๐๐ป๐ +search_placeholder: "๐ฎ๐ฒ๐ ๐๐น ๐๐ป๐ ๐๐ป๐ฅ๐" +search_request: "๐๐ค๐ฐ๐ ๐ง๐ฏ๐๐ผ ๐ฉ ๐ข๐ป๐ ๐น ๐๐ฎ๐ฑ๐ ๐ฉ๐๐ณ๐" +see_all: "๐๐ฐ ๐ท๐ค" +translations: ๐๐ฎ๐จ๐ฏ๐๐ค๐ฑ๐๐ฉ๐ฏ๐ diff --git a/i18n/en.yml b/i18n/en.yml index fab158b..b2ead12 100644 --- a/i18n/en.yml +++ b/i18n/en.yml @@ -14,15 +14,22 @@ tag: talk: one: talk other: talks +match_found: + one: "match found" + other: "matches found" # Rest -next: next -prev: prev -see_all: "see all" -about: about -recent_pages: Pages recently edited _blank: " " -translations: translations +about: about author_by: By minute_read: "min read" +next: next +no_match_found: "no match found" +prev: prev +recent_pages: Pages recently edited rss_follow: "Follow {{ .section }} updates via RSS feed" +search: search +search_placeholder: "write your search terms" +search_request: "Please enter a word or phrase above" +see_all: "see all" +translations: translations diff --git a/layouts/_default/search.html b/layouts/_default/search.html index bcbaad4..1f179bc 100644 --- a/layouts/_default/search.html +++ b/layouts/_default/search.html @@ -2,7 +2,7 @@ <div class="mw7 center pa1"> <header> <h2 class="baskerville f2 lh-title mv3 ph1"> - {{ .Title }} + {{ T "search" }} </h2> </header> @@ -10,14 +10,21 @@ <input id="search-query" name="q" - placeholder="search phrase" + placeholder="{{ T "search_placeholder" }}" class="near-black pa2 w-100" /> </form> - <div id="search-results" class="mv2"></div> + <div id="search-results" class="mv2"> + <p class="pa3 f4 fw6 tc">{{ T "search_request" }}</p> + </div> </div> + <template id="no-match"> + <p class="bg-washed-red pa3 dark-red f4 fw6 tc br2 b--light-red ba"> + {{ T "no_match_found" }} + </p> + </template> <template id="search-result-template"> <article class="pv2 bt bb b--black-10 search_summary"> <a class="link dim near-black search_link" href=""> diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html index 52f4213..f8df88e 100644 --- a/layouts/partials/pagination.html +++ b/layouts/partials/pagination.html @@ -2,7 +2,7 @@ {{ if gt $pag.TotalPages 1 }} <nav class="flex items-center justify-center pa4 f5"> {{ if $pag.HasPrev }} - <a href="{{ $pag.Prev.URL }}" rel="prev" class="near-black link grow hover-bg-light-gray pa2 ba">ยซ {{ T "Prev" }}</a> + <a href="{{ $pag.Prev.URL }}" rel="prev" class="near-black link grow hover-bg-light-gray pa2 ba">ยซ {{ T "prev" }}</a> {{ end }} {{ range $pag.Pagers }} {{ if eq . $pag }} @@ -12,6 +12,6 @@ {{ end }} {{ end }} {{ if $pag.HasNext }} - <a href="{{ $pag.Next.URL }}" rel="next" class="near-black link grow hover-bg-light-gray pa2 ba">{{ T "Next" }} ยป</a> {{ end }} + <a href="{{ $pag.Next.URL }}" rel="next" class="near-black link grow hover-bg-light-gray pa2 ba">{{ T "next" }} ยป</a> {{ end }} </nav> {{ end }} |