diff --git a/templates/core/home.html b/templates/core/home.html index c8a01057a..337a30f29 100644 --- a/templates/core/home.html +++ b/templates/core/home.html @@ -7,7 +7,6 @@ {%- endblock body_classes -%} {%- block topbar -%} - {% set search_query = Some(String::new()) %} {%- include "header/topbar.html" -%} {%- endblock topbar -%} diff --git a/templates/error.html b/templates/error.html index 5ac838a17..339a4c585 100644 --- a/templates/error.html +++ b/templates/error.html @@ -10,6 +10,5 @@

{{ title }}

{%- endblock header -%} {%- block topbar -%} - {% set search_query = Some(String::new()) %} {%- include "header/topbar.html" -%} {%- endblock topbar -%} diff --git a/templates/header/topbar_end.html b/templates/header/topbar_end.html index 7ca3b6a40..94dc7e4cc 100644 --- a/templates/header/topbar_end.html +++ b/templates/header/topbar_end.html @@ -66,7 +66,14 @@ {# If there is a search query, put it in the search bar #} {# The tabindex="-1" is used to prevent it to be the first input focused on the page when using the browser shortcut #} + placeholder="Find crate" + {% if search_query is defined %} + {%- if let Some(query) = search_query %} + {%- if !query.is_empty() +%} + value="{{ query }}" + {%- endif %} + {%- endif %} + {%- endif %}> diff --git a/templates/releases/feed.xml b/templates/releases/feed.xml index 9e3d2a8b0..38281de83 100644 --- a/templates/releases/feed.xml +++ b/templates/releases/feed.xml @@ -16,7 +16,7 @@ {%- for release in recent_releases -%} - {% set link = String::new() %} + {%- set link -%} {%- if release.rustdoc_status && release.target_name.is_some() -%} {%- set link = "/{}/{}/{}/"|format(release.name, release.version, release.target_name.as_ref().unwrap()) -%} {%- else -%} diff --git a/templates/releases/releases.html b/templates/releases/releases.html index e8a60daea..2cbebc0ab 100644 --- a/templates/releases/releases.html +++ b/templates/releases/releases.html @@ -16,7 +16,6 @@ {%- endblock header -%} {%- block topbar -%} - {% set search_query = Some(String::new()) %} {%- include "header/topbar.html" -%} {%- endblock topbar -%} diff --git a/templates/rustdoc/topbar.html b/templates/rustdoc/topbar.html index 6b092147b..b7d11bd74 100644 --- a/templates/rustdoc/topbar.html +++ b/templates/rustdoc/topbar.html @@ -1,7 +1,6 @@ {# The url of the current release, `/crate/:name/:version` #} {%- import "macros.html" as macros -%} -{% set search_query = Some(String::new()) %} {%- include "header/topbar_begin.html" -%} {%- set crate_url = "/crate/{}/{}"|format(metadata.name, metadata.req_version) -%} {%- set rest_menu_url -%}