Skip to content

Commit

Permalink
Merge pull request #4791 from pavinduLakshan/169_hotfix_trailing_slas…
Browse files Browse the repository at this point in the history
…h_issue
  • Loading branch information
pavinduLakshan authored Sep 27, 2024
2 parents bce399f + 3976fc9 commit 259d9cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 0 additions & 2 deletions en/theme/material/assets/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,3 @@ dropdownLink.addEventListener('click', function(event) {
event.stopPropagation(); // Prevent the event from propagating to the document
dropdown.classList.toggle('open'); // Toggle the "open" class
});


10 changes: 10 additions & 0 deletions en/theme/material/partials/javascripts/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- Fix for HTML files loads with wrong resource relative paths when the trailing slash is missing -->
<script>
// Check if the path does not end with a slash and has no file extension
if (!window.location.pathname.endsWith('/') && !window.location.pathname.split('/').pop().includes('.')) {
var newPath = window.location.pathname + '/' + window.location.search + window.location.hash;
window.location.replace(newPath);
}
</script>

<script>__md_scope=new URL("{{ config.extra.scope | d(base_url) }}",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>

0 comments on commit 259d9cc

Please sign in to comment.