Skip to content

Commit

Permalink
Add custom 404 page with redirection for /docs/ URLs and remove unuse…
Browse files Browse the repository at this point in the history
…d JavaScript
  • Loading branch information
juancarmore committed Dec 27, 2024
1 parent ee395cb commit eed0b91
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Empty file removed docs/javascripts/extra.js
Empty file.
17 changes: 17 additions & 0 deletions docs/overrides/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends "main.html" %}

<!-- Content -->
{% block content %}
<h1>404 - Not found</h1>
<script>
// Get the current URL
const path = window.location.pathname;

// Check if the URL starts with "/docs/"
if (path.startsWith('/docs/')) {
// Redirect to "/latest/docs/" preserving the rest of the path
const newPath = path.replace('/docs/', '/latest/docs/');
window.location.replace(newPath);
}
</script>
{% endblock %}
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ extra_css:
- javascripts/openvidu-register/openvidu-register.css

extra_javascript:
- javascripts/extra.js
- javascripts/consent.js
- javascripts/openvidu-register/openvidu-register.js

Expand Down

0 comments on commit eed0b91

Please sign in to comment.