mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
theme: fix showVisitedLinks in case Hugo is configured to modify relative URLs #86
This commit is contained in:
parent
5ef91dbbce
commit
c5382e0bcc
2 changed files with 7 additions and 2 deletions
|
@ -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');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue