Debian Codegraph @

crates/mdbook-html/front-end/templates/redirect.hbs

raw
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <title>Redirecting...</title>
6 <meta http-equiv="refresh" content="0; URL={{url}}">
7 <link rel="canonical" href="{{url}}">
8 </head>
9 <body>
10 <p>Redirecting to... <a href="{{url}}">{{url}}</a>.</p>
11
12 <script>
13 // This handles redirects that involve fragments.
14 document.addEventListener('DOMContentLoaded', function() {
15 const fragmentMap =
16 {{{fragment_map}}}
17 ;
18 const fragment = window.location.hash;
19 if (fragment) {
20 let redirectUrl = "{{url}}";
21 const target = fragmentMap[fragment];
22 if (target) {
23 let url = new URL(target, window.location.href);
24 redirectUrl = url.href;
25 } else {
26 let url = new URL(redirectUrl, window.location.href);
27 url.hash = window.location.hash;
28 redirectUrl = url.href;
29 }
30 window.location.replace(redirectUrl);
31 }
32 // else redirect handled by http-equiv
33 });
34 </script>
35 </body>
36 </html>