Skip to content

Commit

Permalink
Hugo: default search input placeholder
Browse files Browse the repository at this point in the history
When no contentType was used, the search input showed
"Search in <no value". There only is a contentType when using the
search shortcode.

- Default placeholder is now "Search in cuelang.org" (/search/?q=)
- When using the search shortcode with a contentType, you see
eg. "Search in How-to Guides"  (/examples/shortcodes/search/)

For https://linear.app/usmedia/issue/CUE-344

Closes #433 as merged as of commit 730d0b4c.

Signed-off-by: Anne van Gorkom <[email protected]>
Change-Id: Icd38ad5530f7fa3ea4415a164474485e5686884c
Dispatch-Trailer: {"type":"trybot","CL":1172175,"patchset":1,"ref":"refs/changes/75/1172175/1","targetBranch":"alpha"}
  • Loading branch information
anne-usmedia authored and cueckoo committed Nov 14, 2023
1 parent ce04bba commit 24c195b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions hugo/i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ other = "documents found"
[search_filters_title]
other = "Filters"
[search_placeholder]
other = "Search in cuelang.org"
[search_placeholder_content_type]
other = "Search in {{ .contentType }}"

[search_tags_title]
Expand Down
6 changes: 5 additions & 1 deletion hugo/layouts/partials/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
{{ $contentTypes := slice }}
{{ $contentType := .contentType | default "" }}
{{ $type := .type | default "full" }}
{{ $placeholder := (T "search_placeholder" .) }}
{{ $placeholder := (T "search_placeholder" ) }}

{{ if $contentType }}
{{ $placeholder = (T "search_placeholder_content_type" .) }}
{{ end }}

{{ with $context }}
{{ if $showContentTypes }}
Expand Down

0 comments on commit 24c195b

Please sign in to comment.