diff --git a/templates/about-base.html b/templates/about-base.html
index 2ba257fd7..ae9381fbb 100644
--- a/templates/about-base.html
+++ b/templates/about-base.html
@@ -42,7 +42,6 @@
Docs.rs documentation
{% endblock %}
{%- block topbar -%}
- {% set is_latest_version = true %}
{% let search_query = Some(String::new()) %}
{%- include "header/topbar.html" -%}
{%- endblock topbar -%}
diff --git a/templates/core/home.html b/templates/core/home.html
index 80962def2..c8a01057a 100644
--- a/templates/core/home.html
+++ b/templates/core/home.html
@@ -7,7 +7,6 @@
{%- endblock body_classes -%}
{%- block topbar -%}
- {% set is_latest_version = true %}
{% set search_query = Some(String::new()) %}
{%- include "header/topbar.html" -%}
{%- endblock topbar -%}
diff --git a/templates/crate/build_details.html b/templates/crate/build_details.html
index c27ab74fe..de7e45730 100644
--- a/templates/crate/build_details.html
+++ b/templates/crate/build_details.html
@@ -11,7 +11,6 @@
{%- block topbar -%}
{%- set inner_path = metadata.target_name_url() -%}
- {%- set is_latest_version = true -%}
{%- set is_prerelease = false -%}
{%- set has_crate = false %}
{%- include "rustdoc/topbar.html" -%}
diff --git a/templates/crate/builds.html b/templates/crate/builds.html
index 7c8c7c99e..3c7015d5f 100644
--- a/templates/crate/builds.html
+++ b/templates/crate/builds.html
@@ -15,7 +15,6 @@
{%- block topbar -%}
{%- set inner_path = metadata.target_name_url() -%}
- {%- set is_latest_version = true -%}
{%- include "rustdoc/topbar.html" -%}
{%- endblock topbar -%}
diff --git a/templates/crate/details.html b/templates/crate/details.html
index 1c20df212..18386f8dd 100644
--- a/templates/crate/details.html
+++ b/templates/crate/details.html
@@ -11,7 +11,6 @@
{%- block topbar -%}
{%- set inner_path = metadata.target_name_url() -%}
- {%- set is_latest_version = true -%}
{%- include "rustdoc/topbar.html" -%}
{%- endblock topbar -%}
diff --git a/templates/crate/features.html b/templates/crate/features.html
index 7bb97b974..95ffbcadb 100644
--- a/templates/crate/features.html
+++ b/templates/crate/features.html
@@ -11,7 +11,6 @@
{%- block topbar -%}
{%- set inner_path = metadata.target_name_url() -%}
- {%- set is_latest_version = true -%}
{%- include "rustdoc/topbar.html" -%}
{%- endblock topbar -%}
diff --git a/templates/crate/source.html b/templates/crate/source.html
index 6e8567d56..8678c122e 100644
--- a/templates/crate/source.html
+++ b/templates/crate/source.html
@@ -7,7 +7,6 @@
{%- block topbar -%}
{%- set inner_path = metadata.target_name_url() -%}
- {%- set is_latest_version = true -%}
{%- include "rustdoc/topbar.html" -%}
{%- endblock topbar -%}
diff --git a/templates/error.html b/templates/error.html
index 4059be8b7..5ac838a17 100644
--- a/templates/error.html
+++ b/templates/error.html
@@ -10,7 +10,6 @@ {{ title }}
{%- endblock header -%}
{%- block topbar -%}
- {% set is_latest_version = true %}
{% set search_query = Some(String::new()) %}
{%- include "header/topbar.html" -%}
{%- endblock topbar -%}
diff --git a/templates/header/topbar_begin.html b/templates/header/topbar_begin.html
index 605acb6d8..012073869 100644
--- a/templates/header/topbar_begin.html
+++ b/templates/header/topbar_begin.html
@@ -10,7 +10,7 @@
method="GET"
id="nav-search-form"
class="landing-search-form-nav {%
- if !is_latest_version %}not-latest{% endif
+ if is_latest_version is defined && !is_latest_version %}not-latest{% endif
%} {% if metadata is defined && metadata.yanked.unwrap_or_default() %}yanked{% endif %}">
{# The top-left logo and name #}
diff --git a/templates/releases/activity.html b/templates/releases/activity.html
index 7507cdc3d..5d6203776 100644
--- a/templates/releases/activity.html
+++ b/templates/releases/activity.html
@@ -8,7 +8,6 @@
{%- endblock header -%}
{%- block topbar -%}
- {% set is_latest_version = true %}
{% let search_query = Some(String::new()) %}
{%- include "header/topbar.html" -%}
{%- endblock topbar -%}
diff --git a/templates/releases/build_queue.html b/templates/releases/build_queue.html
index 1e93066b4..8ce8d5d5f 100644
--- a/templates/releases/build_queue.html
+++ b/templates/releases/build_queue.html
@@ -8,7 +8,6 @@
{%- endblock header -%}
{%- block topbar -%}
- {% set is_latest_version = true %}
{% let search_query = Some(String::new()) %}
{%- include "header/topbar.html" -%}
{%- endblock topbar -%}
diff --git a/templates/releases/releases.html b/templates/releases/releases.html
index 08dca028e..e8a60daea 100644
--- a/templates/releases/releases.html
+++ b/templates/releases/releases.html
@@ -16,7 +16,6 @@
{%- endblock header -%}
{%- block topbar -%}
- {% set is_latest_version = true %}
{% set search_query = Some(String::new()) %}
{%- include "header/topbar.html" -%}
{%- endblock topbar -%}
diff --git a/templates/releases/search_results.html b/templates/releases/search_results.html
index 82ce41114..07d4de83f 100644
--- a/templates/releases/search_results.html
+++ b/templates/releases/search_results.html
@@ -6,7 +6,6 @@
{%- endblock header -%}
{%- block topbar -%}
- {% set is_latest_version = true %}
{% let search_query = search_query %}
{%- include "header/topbar.html" -%}
{%- endblock topbar -%}
diff --git a/templates/rustdoc/topbar.html b/templates/rustdoc/topbar.html
index f0ea5d26c..6b092147b 100644
--- a/templates/rustdoc/topbar.html
+++ b/templates/rustdoc/topbar.html
@@ -179,7 +179,7 @@
{#- If this is the latest release and it's been yanked, just display a warning -#}
{%- set yanked = metadata.yanked.unwrap_or_default() -%}
- {%- if is_latest_version && yanked -%}
+ {%- if (is_latest_version is not defined || is_latest_version) && yanked -%}
{#- If this isn't the most recent stable release, offer a link to the latest -#}
- {%- elif !is_latest_version -%}
+ {%- elif is_latest_version is defined && !is_latest_version -%}
{% set tooltip %}
{% set title %}
{%- if yanked -%}