Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/spech66/bootstrap-bp-hugo-startpage.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pech <windows@spech.de>2021-03-27 08:56:06 +0300
committerSebastian Pech <windows@spech.de>2021-03-27 08:56:06 +0300
commitc3e41f4e2e01bd7151a7c2e3f529d051100e1891 (patch)
tree43c8e15aa09278c5e662e097c903bc7f949a961c
parent05b68249d6c5789a171cdaf2066d8d5aab7fd1ad (diff)
Added searchkey parameter (e.g. Baidu search)
-rw-r--r--README.md6
-rw-r--r--exampleSite/config.toml6
-rw-r--r--layouts/index.html2
3 files changed, 13 insertions, 1 deletions
diff --git a/README.md b/README.md
index 063bdc3..b7cb6b6 100644
--- a/README.md
+++ b/README.md
@@ -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 }}