mirror of
https://github.com/McShelby/hugo-theme-relearn
synced 2025-04-30 20:46:33 +08:00
theme: fix showVisitedLinks in case Hugo is configured to modify relative URLs #86
This commit is contained in:
parent
5ef91dbbce
commit
c5382e0bcc
@ -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…
x
Reference in New Issue
Block a user