forked from CodeYourFuture/syllabus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove trailing slashes when on pages.
Fixes CodeYourFuture#121 See commentary in CodeYourFuture#254 (comment)
- Loading branch information
1 parent
4f8b166
commit 9ad4e6b
Showing
2 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Work around https://github.com/CodeYourFuture/syllabus/issues/121 by stripping trailing slashes from paths. | ||
// | ||
// See https://github.com/CodeYourFuture/syllabus/issues/121 and https://github.com/CodeYourFuture/syllabus/pull/254 and https://github.com/facebook/docusaurus/issues/2394 and https://github.com/facebook/docusaurus/issues/3372 for more context. | ||
|
||
// This workaround was borrowed from https://github.com/facebook/docusaurus/issues/2394#issuecomment-630638096 | ||
if (window && window.location && window.location.pathname.endsWith('/') && window.location.pathname !== '/') { | ||
window.history.replaceState('', '', window.location.pathname.substr(0, window.location.pathname.length - 1)) | ||
} |