|
1 | 1 | <article class="doc">
|
2 | 2 | <h1 class="page">{{{or page.title 'Page Not Found'}}}</h1>
|
3 | 3 | <div class="paragraph">
|
4 |
| -<p>The page you’re looking for does not exist. It may have been moved. You can{{#with site.homeUrl}} return to the <a href="{{{this}}}">start page</a>, or{{/with}} follow one of the links in the navigation to the left.</p> |
| 4 | +<p>The page you’re looking for does not exist. It may have been moved. You can{{#with site.homeUrl}} return to the <a id="return-link" href="{{{this}}}">start page</a>, or{{/with}} follow one of the links in the navigation to the left.</p> |
5 | 5 | </div>
|
6 | 6 | <div class="paragraph">
|
7 | 7 | <p>If you arrived on this page by clicking on a link, please notify the owner of the site that the link is broken.
|
8 | 8 | If you typed the URL of this page manually, please double check that you entered the address correctly.</p>
|
9 | 9 | </div>
|
10 | 10 | </article>
|
| 11 | +<script> |
| 12 | +;(function (pathname, returnLink) { |
| 13 | + if (!returnLink) return |
| 14 | + var startPages = [ |
| 15 | + {{#each site.components}} |
| 16 | + {{#if (or ./versions.[1] (ne ./versions.[0].version 'master'))}} |
| 17 | + {{#each ./versions}} |
| 18 | + { name: "{{{./name}}}", title: "{{{./title}}}", version: "{{{./version}}}", url: "{{{./url}}}" }, |
| 19 | + {{/each}} |
| 20 | + {{/if}} |
| 21 | + { name: "{{{./name}}}", title: "{{{./title}}}", url: "{{{./url}}}" }, |
| 22 | + {{/each}} |
| 23 | + ].reduce(function (accum, it) { |
| 24 | + if ('version' in it) { |
| 25 | + accum[it.url.replace(/\/(?:index\.html?$)/, '')] = it |
| 26 | + } else { |
| 27 | + if (!('/' + it.name in accum)) accum['/' + it.name] = it |
| 28 | + } |
| 29 | + return accum |
| 30 | + }, {}) |
| 31 | + var returnTo |
| 32 | + var segments = pathname.split('/').slice(0, -1) |
| 33 | + while (segments.length > 1) { |
| 34 | + if ((returnTo = startPages[segments.join('/')])) break |
| 35 | + segments.pop() |
| 36 | + } |
| 37 | + if (returnTo) { |
| 38 | + returnLink.href = returnTo.url |
| 39 | + returnLink.innerText = |
| 40 | + 'start page for the ' + returnTo.title + ' ' + |
| 41 | + ((returnTo.version || 'master' !== 'master') ? returnTo.version + ' ' : '') + 'documentation' |
| 42 | + } |
| 43 | +})(window.location.pathname, document.getElementById('return-link')) |
| 44 | +</script> |
0 commit comments