Add search placeholder by calc pages and tags

ex. Search among X titles and Y tags.
Removes param searchBoxPlaceholder
This commit is contained in:
Aditya Telange
2023-05-21 10:20:00 +05:30
parent 435a64267b
commit 030461a769
2 changed files with 16 additions and 10 deletions

View File

@@ -10,15 +10,14 @@
### Variables
| Variable | Value | Description |
| ----------------------- | ------------------------ | ----------- |
| `params.showDescriptioninHome` | `true` | |
| `params.hideAllTagsinHome` | `true` | |
| `params.searchBoxPlaceholder` | `Type here to search...` | |
| `params.titleIcon` | `index.png` | |
| `params.headers.key` | `Title` | |
| `params.headers.value` | `Tags` | |
| `permalinks.tags` | `@:slug` | |
| Variable | Value | Description |
| ------------------------------ | ----------- | ----------- |
| `params.showDescriptioninHome` | `true` | |
| `params.hideAllTagsinHome` | `true` | |
| `params.titleIcon` | `index.png` | |
| `params.headers.key` | `Title` | |
| `params.headers.value` | `Tags` | |
| `permalinks.tags` | `@:slug` | |
### Powered by

View File

@@ -1,3 +1,10 @@
<div class="searchBox">
<input id="search" autofocus type="search" placeholder='{{ site.Params.searchBoxPlaceholder | default "Search ..." }}' autocomplete="off" />
<input id="search" autofocus type="search" placeholder='
{{- with site.Params.headers }}
{{- print "Search among" }}
{{- printf " %d %s " (len site.RegularPages) (.key | pluralize | lower) }}
{{- print "and" }}
{{- printf " %d %s..." (len site.Taxonomies.tags) (.value | pluralize | lower) }}
{{- end -}}
' autocomplete="off" />
</div>