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

github.com/Vimux/mainroad.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvimux <vimux@protonmail.com>2022-08-18 19:10:41 +0300
committervimux <vimux@protonmail.com>2022-08-18 19:12:20 +0300
commit68e677f170441b26895db8f5abb9e4c87c1bb700 (patch)
treefdabbb8c5fc06c216dd024612457150a23a7731b /layouts
parent8b4ca24036e7940ab025684ceeecdd52754cf689 (diff)
Merge two search widgets into one
* search.html widget: add configurable params (`url`, `input.name`, `input.pre`) * ddg-search.html: add deprecation warning * Add search box customization guide * Update README: add `params.widgets.search` example * Update README: remove mentions of ddg-search widget
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/widgets/ddg-search.html1
-rw-r--r--layouts/partials/widgets/search.html8
2 files changed, 7 insertions, 2 deletions
diff --git a/layouts/partials/widgets/ddg-search.html b/layouts/partials/widgets/ddg-search.html
index 8c8da20..094ca58 100644
--- a/layouts/partials/widgets/ddg-search.html
+++ b/layouts/partials/widgets/ddg-search.html
@@ -1,3 +1,4 @@
+<!-- DEPRECATED WIDGET! DON'T USE IT! -->
<div class="widget-search widget">
<form class="widget-search__form" role="search" method="get" action="https://duckduckgo.com/">
<label>
diff --git a/layouts/partials/widgets/search.html b/layouts/partials/widgets/search.html
index d6b1652..e29b6ca 100644
--- a/layouts/partials/widgets/search.html
+++ b/layouts/partials/widgets/search.html
@@ -1,9 +1,13 @@
+{{- $actionURL := .Site.Params.widgets.search.url | default "https://google.com/search" -}}
+{{- $inputName := .Site.Params.widgets.search.input.name | default "sitesearch" -}}
+{{- $inputPre := .Site.Params.widgets.search.input.pre -}}
+
<div class="widget-search widget">
- <form class="widget-search__form" role="search" method="get" action="https://google.com/search">
+ <form class="widget-search__form" role="search" method="get" action="{{ $actionURL }}">
<label>
<input class="widget-search__field" type="search" placeholder="{{ T "search_placeholder" }}" value="" name="q" aria-label="{{ T "search_placeholder" }}">
</label>
<input class="widget-search__submit" type="submit" value="Search">
- <input type="hidden" name="sitesearch" value="{{ .Site.BaseURL }}" />
+ {{ if $inputName -}}<input type="hidden" name="{{ $inputName }}" value="{{ $inputPre }}{{ .Site.BaseURL }}">{{- end }}
</form>
</div> \ No newline at end of file