Files
Lukas Tenbrink c3c1e085ec Add redirects.csv upload system from the godot-docs.
Add redirects js fallback, from the godot-docs.
Move `docunmentation/translation` to `other/translation`, since translation is not just documentation but also the editor (and perhaps in the future, other places).
2025-12-09 21:28:10 +01:00

61 lines
2.1 KiB
ReStructuredText

:github_url: hide
:allow_comments: False
Page not found
==============
.. https://github.com/readthedocs/sphinx-notfound-page
.. raw:: html
<p>
Sorry, we couldn't find that page. It may have been renamed or removed
in the version of the documentation you're currently browsing.
</p>
<p>
Note that you are currently browsing the <em>contributing</em> documentation.
If you're looking for engine information, please browse
<a href="https://docs.godotengine.org/en/stable/">docs.godotengine.org</a> instead.
</p>
<p>
Alternatively, use the
<a href="#" onclick="$('#rtd-search-form [name=\\'q\\']').focus()">Search docs</a>
box on the left or <a href="/">go to the homepage</a>.
</p>
<script>
// Keep this in sync with the version from godot-docs.
// Check for redirects if on a currently invalid page.
// This is done in JavaScript, as we exceed Read the Docs' limit for the amount of redirects configurable.
const currentPathSegments = window.location.pathname.split('/').filter(segment => segment !== '');
// Use the base path (e.g. "/en/latest") when available.
const currentBasePath = (currentPathSegments.length >= 2) ? ("/" + currentPathSegments.slice(0, 2).join("/")) : "/";
fetch(currentBasePath + "/_static/redirects.csv")
.then(response => response.text())
.then(csvText => {
const lines = csvText.trim().split('\n');
for (const line of lines) {
if (!line.trim()) {
continue;
}
const [from, to] = line.split(',').map(s => s.trim());
if (from && to) {
if (window.location.pathname.endsWith(from)) {
if (to.startsWith('https://')) {
window.location.replace(to);
} else {
const newUrl = window.location.href.replace(window.location.pathname, to);
window.location.replace(newUrl);
}
}
}
}
})
.catch(err => {
console.error("Couldn't fetch redirects list:", err);
});
</script>