diff --git a/src/server/response.cpp b/src/server/response.cpp index 50fd7b4a..2587d8d3 100644 --- a/src/server/response.cpp +++ b/src/server/response.cpp @@ -387,6 +387,8 @@ NewHTTP404Response::NewHTTP404Response(const RequestContext& request, {"url_path", urlPath}, {"PAGE_TITLE", Data::fromMsgId("new-404-page-title")}, {"PAGE_HEADING", Data::fromMsgId("new-404-page-heading")}, + {"404_img_text", Data::fromMsgId("404-img-text")}, + {"path_was_not_found_msg", Data::fromMsgId("path-was-not-found")}, }); } diff --git a/static/skin/i18n/en.json b/static/skin/i18n/en.json index ec398c02..e2d3bc91 100644 --- a/static/skin/i18n/en.json +++ b/static/skin/i18n/en.json @@ -22,6 +22,8 @@ , "404-page-heading" : "Not Found" , "new-404-page-title" : "Page not found" , "new-404-page-heading" : "Oops. Page not found." + , "404-img-text": "Not found!" + , "path-was-not-found": "The requested path was not found:" , "500-page-title" : "Internal Server Error" , "500-page-heading" : "Internal Server Error" , "500-page-text": "An internal server error occured. We are sorry about that :/" diff --git a/static/skin/i18n/qqq.json b/static/skin/i18n/qqq.json index a1699b35..86dcde6d 100644 --- a/static/skin/i18n/qqq.json +++ b/static/skin/i18n/qqq.json @@ -26,6 +26,8 @@ "404-page-heading": "Heading of the 404 error page", "new-404-page-title": "Title of the 404 error page", "new-404-page-heading": "Heading of the 404 error page", + "404-img-text": "Fallback text for the image on the 404 error page", + "path-was-not-found": "Message telling that the URL path was not found (to be followed by the actual path)", "500-page-title": "Title of the 500 error page", "500-page-heading": "Heading of the 500 error page", "500-page-text": "Text of the 500 error page", diff --git a/static/skin/i18n/test.json b/static/skin/i18n/test.json index 3000ca0c..34ed4871 100644 --- a/static/skin/i18n/test.json +++ b/static/skin/i18n/test.json @@ -15,6 +15,8 @@ , "404-page-heading": "[I18N TESTING] Content not found, but at least the server is alive" , "new-404-page-title" : "Page [I18N] not [TESTING] found" , "new-404-page-heading" : "[I18N TESTING] Oops. Larry Page could not be reached. He may be on paternity leave." + , "404-img-text": "[I18N] Not found! [TESTING]" + , "path-was-not-found": "[I18N TESTING] The requested path was not found (in fact, nothing was found instead, either):" , "library-button-text": "[I18N TESTING] Navigate to the welcome page" , "home-button-text": "[I18N TESTING] Jump to the main page of '{{BOOK_TITLE}}'" , "random-page-button-text": "[I18N TESTING] I am tired of determinism" diff --git a/static/templates/sexy404.html b/static/templates/sexy404.html index 5f60f5ac..582c653c 100644 --- a/static/templates/sexy404.html +++ b/static/templates/sexy404.html @@ -13,13 +13,13 @@
Not found! + alt="{{404_img_text}}" + aria-label="{{404_img_text}}" + title="{{404_img_text}}">

{{PAGE_HEADING}}

-

The requested path was not found:

+

{{path_was_not_found_msg}}

{{url_path}}

diff --git a/test/server.cpp b/test/server.cpp index 07e25597..dac001a6 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -346,7 +346,7 @@ R"EXPECTEDRESULT( - window.KIWIX_RESPONSE_TEMPLATE = "<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <title>{{PAGE_TITLE}}</title>\n <link type="text/css" href="{{root}}/skin/error.css?cacheid=c49d1586" rel="Stylesheet" />\n{{#KIWIX_RESPONSE_DATA}} <script>\n window.KIWIX_RESPONSE_TEMPLATE = "{{KIWIX_RESPONSE_TEMPLATE}}";\n window.KIWIX_RESPONSE_DATA = {{{KIWIX_RESPONSE_DATA}}};\n </script>{{/KIWIX_RESPONSE_DATA}}\n </head>\n <body>\n <header>\n <img src="{{root}}/skin/404.svg?cacheid=b6d648af"\n alt="Not found!"\n aria-label="Not found!"\n title="Not found!">\n </header>\n <section class="intro">\n <h1>{{PAGE_HEADING}}</h1>\n <p>The requested path was not found:</p>\n <p><code>{{url_path}}</code></p>\n </section>\n <section class="advice">\n <p>The content you're looking for may still be available, but it might be located at a different place within the ZIM file.</p>\n <p class="list-intro">Please:</p>\n <ul>\n <li>Try using the search function to find the content you want</li>\n <li>Look for keywords or titles related to the information you're seeking</li>\n </ul>\n <p>This approach should help you locate the desired content, even if the original link isn't working properly.</p>\n </section>\n </body>\n</html>\n"; + window.KIWIX_RESPONSE_TEMPLATE = "<!DOCTYPE html>\n<html>\n <head>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n <title>{{PAGE_TITLE}}</title>\n <link type="text/css" href="{{root}}/skin/error.css?cacheid=c49d1586" rel="Stylesheet" />\n{{#KIWIX_RESPONSE_DATA}} <script>\n window.KIWIX_RESPONSE_TEMPLATE = "{{KIWIX_RESPONSE_TEMPLATE}}";\n window.KIWIX_RESPONSE_DATA = {{{KIWIX_RESPONSE_DATA}}};\n </script>{{/KIWIX_RESPONSE_DATA}}\n </head>\n <body>\n <header>\n <img src="{{root}}/skin/404.svg?cacheid=b6d648af"\n alt="{{404_img_text}}"\n aria-label="{{404_img_text}}"\n title="{{404_img_text}}">\n </header>\n <section class="intro">\n <h1>{{PAGE_HEADING}}</h1>\n <p>{{path_was_not_found_msg}}</p>\n <p><code>{{url_path}}</code></p>\n </section>\n <section class="advice">\n <p>The content you're looking for may still be available, but it might be located at a different place within the ZIM file.</p>\n <p class="list-intro">Please:</p>\n <ul>\n <li>Try using the search function to find the content you want</li>\n <li>Look for keywords or titles related to the information you're seeking</li>\n </ul>\n <p>This approach should help you locate the desired content, even if the original link isn't working properly.</p>\n </section>\n </body>\n</html>\n"; Page not found