mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
Add redirect from old URL to new URL
This commit is contained in:
+10
-1
@@ -71,11 +71,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var match = new RegExp('#/(.+)\.md(.*)', 'g').exec(window.location.hash);
|
||||
if (match && match[1]) {
|
||||
// Redirect from URL format to new URL, for example:
|
||||
// Old: https://marked.js.org/#/USING_PRO.md#renderer
|
||||
// New: https://marked.js.org/using_pro#renderer
|
||||
var pageName = match[1].toLowerCase();
|
||||
var sectionName = match[2];
|
||||
window.location.href = '/' + pageName + sectionName;
|
||||
}
|
||||
|
||||
var navLinks = document.querySelectorAll('nav a');
|
||||
|
||||
function hashChange() {
|
||||
var fullUrl = window.location.href;
|
||||
|
||||
navLinks.forEach(function(link) {
|
||||
link.className = link.href === fullUrl ? 'selected' : '';
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user