Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 41 additions & 2 deletions src/partials/body-404.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,51 @@
<article class="doc">
<h1 class="page">{{{or page.title 'Page Not Found'}}}</h1>
<div class="paragraph">
<p>The page you're looking for does not exist. It may have been moved.</p>
<p>The page you&#8217;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 above.</p>
</div>
<div class="paragraph">
<p>If you arrived on this page by clicking on a link, please notify the owner of the site that the link is broken.
<p>If you arrived on this page by clicking a link on another site, please notify the owner of that site that the link is broken.
If you typed the URL of this page manually, please double check that you entered the address correctly.</p>
</div>
</article>
<script>
;(function (pathname, returnLink) {
if (!returnLink) return
var startPages = [
{{#each site.components}}
{ name: "{{{./name}}}", title: "{{{./title}}}", url: "{{{@root.site.path}}}{{{./url}}}", prefix: "{{{@root.site.path}}}/{{{./name}}}" },
{{#each ./versions}}
{{#unless (eq ./version 'master')}}
{ name: "{{{./name}}}", title: "{{{./title}}}", version: "{{{./version}}}", url: "{{{@root.site.path}}}{{{./url}}}", prefix: "{{{@root.site.path}}}/{{{./name}}}/{{{./version}}}" },
{{/unless}}
{{/each}}
{{/each}}
].reduce(function (accum, it) {
var prefix = it.prefix
delete it.prefix
if (('version' in it) && !it.url.startsWith(prefix + '/')) {
var prefixSegments = prefix.split('/')
var versionSegmentIdx = prefixSegments.findIndex((segment) => segment === it.version)
prefixSegments.splice(versionSegmentIdx, 1, it.url.split('/')[versionSegmentIdx])
prefix = prefixSegments.join('/')
}
accum[prefix] = it
return accum
}, {})
var returnTo
var segments = pathname.split('/').slice(0, -1)
while (segments.length > 1) {
if ((returnTo = startPages[segments.join('/')])) break
segments.pop()
}
if (returnTo) {
returnLink.href = returnTo.url
returnLink.innerText =
'start page for the ' + returnTo.title + ' ' +
(returnTo.version ? returnTo.version + ' ' : '') +
'documentation'
}
})(window.location.pathname, document.getElementById('return-link'))
</script>
</main>
</div>