diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html
index a1f9828266..e0fdd153d3 100644
--- a/layouts/partials/menu.html
+++ b/layouts/partials/menu.html
@@ -135,7 +135,7 @@
{{else}}
-
+
{{ partial "menu-pre.html" . }}{{or .Params.menuTitle .LinkTitle .Title}}{{ partial "menu-post.html" . }}
{{ if $showvisitedlinks}}{{end}}
diff --git a/static/js/relearn.js b/static/js/relearn.js
index 55b2ea46cc..2b725491df 100644
--- a/static/js/relearn.js
+++ b/static/js/relearn.js
@@ -527,7 +527,12 @@ jQuery(function() {
// loop through the sessionStorage and see if something should be marked as visited
for (var url in sessionStorage) {
- if (sessionStorage.getItem(url) == 1) jQuery('[data-nav-id="' + url + '"]').addClass('visited');
+ if (sessionStorage.getItem(url) == 1){
+ // in case we have `relativeURLs=true` we have to strip the
+ // relative path to root
+ url = url.replace( /\.\.\//g, '/' ).replace( /^\/+\//, '/' );
+ jQuery('[data-nav-id="' + url + '"]').addClass('visited');
+ }
}
});