mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-02-17 09:10:08 +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
|
// loop through the sessionStorage and see if something should be marked as visited
|
||||||
for (var url in sessionStorage) {
|
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…
Add table
Reference in a new issue