diff --git a/templates/base.html b/templates/base.html
index 0f1d7025dd45feb74965735f933630fdc6cd1ec9..ae9ffcb83d68af7e1617b5b9eb3a7c3354217dfc 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -61,7 +61,7 @@
                     {% for title,url in MENUITEMS %}
                         {% if url is string %}
                             {% if title != 'Search' %}
-                                <li {% if output_file == link %}class="active"{% endif %}>
+                                <li {% if output_file == url %}class="active"{% endif %}>
                                     <a href="{{ genurl( url ) }}" {{ newtab(url) }}>{{ title }}</a>
                                 </li>
                             {% endif %}
@@ -69,7 +69,7 @@
                         {% elif url is iterable %}
                             <li class="btn-group
                                 {%- for title,item_url in url -%}
-                                    {%- if item_url == link -%}
+                                    {%- if item_url == output_file -%}
                                         {{- ' active' -}}
                                     {%- endif -%}
                                 {%- endfor -%}
@@ -79,7 +79,7 @@
                                 </a>
                                 <ul class="dropdown-menu" role="menu">
                                 {% for title,item_url in url %}
-                                    <li {% if item_url == link %}class="active"{% endif %}>
+                                    <li {% if item_url == output_url %}class="active"{% endif %}>
                                         <a href="{{ genurl( item_url ) }}" {{ newtab(item_url) }}>{{ title }}</a>
                                     </li>
                                 {% endfor %}