diff options
author | Linlin Yan <yanlinlin82@gmail.com> | 2022-04-05 04:07:34 +0300 |
---|---|---|
committer | Linlin Yan <yanlinlin82@gmail.com> | 2022-04-05 04:07:34 +0300 |
commit | cfedd707ac31fc3f82c7b812ae72c385779cc134 (patch) | |
tree | 52138d17e7e8b20c64848b72d6e3cf34783f556c | |
parent | a39ec12910c296a689629b39cc99228bc2ec76b5 (diff) |
Correct param checking.
-rw-r--r-- | layouts/partials/search.html | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/layouts/partials/search.html b/layouts/partials/search.html index 789c762..4156a96 100644 --- a/layouts/partials/search.html +++ b/layouts/partials/search.html @@ -1,4 +1,5 @@ -{{ if .Site.Params.Search -}} +{{ if isset site.Params "search" -}} +{{ if eq site.Params.Search "baidu" -}} <div class="search"> <script> function check_search() { @@ -8,7 +9,7 @@ document.getElementById('keyword').focus(); return false; } - document.getElementById('wd').value = s + " site:{{ .Site.BaseURL }}"; + document.getElementById('wd').value = s + " site:{{ site.BaseURL }}"; return true; } </script> @@ -20,4 +21,7 @@ </svg></button> </form> </div> +{{ else -}} +{{ errorf "Unknown 'Site.Params.Search' value '%s'! Only 'baidu' is supported now." site.Params.Search }} +{{ end -}} {{ end -}} |