diff options
author | Sebastian Pech <windows@spech.de> | 2021-03-27 08:56:06 +0300 |
---|---|---|
committer | Sebastian Pech <windows@spech.de> | 2021-03-27 08:56:06 +0300 |
commit | c3e41f4e2e01bd7151a7c2e3f529d051100e1891 (patch) | |
tree | 43c8e15aa09278c5e662e097c903bc7f949a961c | |
parent | 05b68249d6c5789a171cdaf2066d8d5aab7fd1ad (diff) |
Added searchkey parameter (e.g. Baidu search)
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | exampleSite/config.toml | 6 | ||||
-rw-r--r-- | layouts/index.html | 2 |
3 files changed, 13 insertions, 1 deletions
@@ -43,6 +43,12 @@ Activate the search engine you want to use (or add a new one). name = "Bing" activated = true url = "https://www.bing.com/search" + +[[params.searchEngines]] + name = "Baidu" + activated = true + url = "https://baidu.com/" + searchkey = "kw" ``` ![startPageColumns = false](https://raw.githubusercontent.com/spech66/bootstrap-bp-hugo-startpage/master/images/screenshot.png) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 59471c8..1fc7c14 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -44,4 +44,10 @@ paginate = 5 activated = true url = "https://www.bing.com/search" +[[params.searchEngines]] + name = "Baidu" + activated = true + url = "https://baidu.com/s" + searchkey = "wd" + [taxonomies] diff --git a/layouts/index.html b/layouts/index.html index a2bf444..48a4d3e 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -6,7 +6,7 @@ {{ range .Site.Params.searchEngines }} {{ if .activated }} <form id="search-form-{{ .name }}" class="mb-3" action="{{ .url }}" method="get"> - <input id="search-bar-{{ .name }}" class="form-control" type="text" autofocus type="text" placeholder="Search {{ .name }}" name="q" alt="Search {{ .name }}" onkeydown="if(event.keyCode === 13) { this.form.submit(); return false; }"> + <input id="search-bar-{{ .name }}" class="form-control" type="text" autofocus type="text" placeholder="Search {{ .name }}" name="{{ cond (isset . "searchkey") .searchkey "q" }}" alt="Search {{ .name }}" onkeydown="if(event.keyCode === 13) { this.form.submit(); return false; }"> </form> {{ end }} {{ end }} |