This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch feat/versioning-and-htaccess
in repository https://gitbox.apache.org/repos/asf/cordova-docs.git

commit eb1393b59928b3decf797c3c6b80e098f21c8dbd
Author: Erisu <[email protected]>
AuthorDate: Fri Jan 9 12:39:00 2026 +0900

    docs: update 404 page for latest only
---
 www/http/404.html    |  4 ++--
 www/static/js/404.js | 21 +++++++++++----------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/www/http/404.html b/www/http/404.html
index e069fed1e6..1e258e69a2 100644
--- a/www/http/404.html
+++ b/www/http/404.html
@@ -32,10 +32,10 @@ priority: 0.1
             <div class="alert alert-warning" role="alert">It looks like the 
content has <em>moved</em> <a id="new-redirect-link">here</a>.</div>
         </div>
         <div id="no-version-redirect-alert" class="not-found-redirect">
-            <div class="alert alert-warning" role="alert">It looks like this 
version <em>isn't translated</em>. The in-development version is <a 
id="dev-redirect-link">here</a>.</div>
+            <div class="alert alert-warning" role="alert">It looks like this 
page <em>doesn't exist in archive</em>. Try and see if the latest version 
exists <a id="latest-redirect-link">here</a>.</div>
         </div>
         <div id="no-page-redirect-alert" class="not-found-redirect">
-            <div class="alert alert-warning" role="alert">It looks like this 
page <em>doesn't exist in this version</em> of the docs. The main page for this 
version is <a id="root-redirect-link">here</a>.</div>
+            <div class="alert alert-warning" role="alert">It looks like this 
page <em>doesn't exist in</em> of the docs. <a id="root-redirect-link">Go to 
the main doc page</a>.</div>
         </div>
     </div>
 </div>
diff --git a/www/static/js/404.js b/www/static/js/404.js
index cecf83fe95..0adc91f297 100644
--- a/www/static/js/404.js
+++ b/www/static/js/404.js
@@ -4,7 +4,7 @@
     // NOTE:
     //      these patterns should NOT contain capturing groups (parentheses)
     //      because they might be combined with other regexes
-    var DOCS_VERSION_PATTERN      = "(?:[\\d\\.]+x?|dev|latest)";
+    var DOCS_VERSION_PATTERN      = 
"(?:\\d+\\.\\d+\\.\\d+|\\d+\\.x(?:-\\d{4}\\.\\d{2})?|dev|latest)";
     var DOCS_LANGUAGE_PATTERN     = "\\w\\w(?:-\\w\\w)?";
     var DOCS_VERSION_PATH_PATTERN = "docs\\/" + DOCS_LANGUAGE_PATTERN + "\\/" 
+ DOCS_VERSION_PATTERN;
 
@@ -38,10 +38,11 @@
         return baseURL + versionString + pageExtension;
     }
 
-    function getDevURL(url) {
-        var replaceWhat = new RegExp("docs\\/(" + DOCS_LANGUAGE_PATTERN + 
")\\/" + DOCS_VERSION_PATTERN);
-        var replaceWith = "docs/$1/dev";
-        return url.replace(replaceWhat, replaceWith);
+    function getLatestURL(url) {
+        return url.replace(
+            new 
RegExp(`(archive/)?docs/(${DOCS_LANGUAGE_PATTERN})/${DOCS_VERSION_PATTERN}`),
+            'docs/en/latest'
+        );
     }
 
     function getRootURL(url) {
@@ -62,8 +63,8 @@
         $("#not-found-redirect-alert").css("display", "block");
     }
 
-    function showDevRedirect(url) {
-        $("#dev-redirect-link").attr("href", url);
+    function showLatestRedirect(url) {
+        $("#latest-redirect-link").attr("href", url);
         $("#no-version-redirect-alert").css("display", "block");
     }
 
@@ -82,7 +83,7 @@
 
         // get related URLs
         var rootURL = getRootURL(url);
-        var devURL = getDevURL(url);
+        var latestURL = getLatestURL(url);
         var newURL  = transformOldURL(url);
 
         // try the root URL
@@ -110,9 +111,9 @@
                 },
 
                 // if root doesn't exist, assume that the version
-                // is invalid and redirect to dev
+                // is invalid and redirect to latest
                 404: function () {
-                    showDevRedirect(devURL)
+                    showLatestRedirect(latestURL)
                 }
             }
         });


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to