Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add 404 and sitemap handler (#1181)
Leendert de Borstee2fd9f9aee9
diff --git a/docs/404.html b/docs/404.htmlnew file mode 100644index 000000000..dfd401c61--- /dev/null+++ b/docs/404.html@@ -0,0 +1,68 @@+---+layout: default+title: 404 - Page not found+permalink: /404.html+nav_exclude: true+search_exclude: true+---++<style>+ .error-404 {+ text-align: center;+ padding: 4rem 2rem;+ }+ .error-404 h1 {+ font-size: 6rem;+ color: #f49541;+ margin-bottom: 1rem;+ }+ .error-404 h2 {+ font-size: 2rem;+ margin-bottom: 1rem;+ color: #f8f9fa;+ }+ .error-404 p {+ font-size: 1.2rem;+ margin-bottom: 2rem;+ color: #d1d5db;+ }+ .error-404 .btn {+ display: inline-block;+ padding: 0.75rem 1.5rem;+ background-color: #d68338;+ color: white;+ text-decoration: none;+ border-radius: 4px;+ transition: background-color 0.2s;+ }+ .error-404 .btn:hover {+ background-color: #f49541;+ }+ .error-404 .links {+ margin-top: 2rem;+ }+ .error-404 .links a {+ margin: 0 1rem;+ color: #f49541;+ text-decoration: underline;+ }+ .error-404 .links a:hover {+ color: #ffd5a8;+ }+</style>++<div class="error-404">+ <h1>404</h1>+ <h2>Page Not Found</h2>+ <p>The page you're looking for doesn't exist or may have been moved.</p>+ <p>This could happen if the documentation structure has been reorganized or the page has been renamed.</p>++ <a href="{{ '/' | relative_url }}" class="btn">Go to Home</a>++ <div class="links">+ <p>Or try these helpful links:</p>+ <a href="{{ '/installation/' | relative_url }}">Installation Guide</a>+ <a href="{{ '/browser-extension/' | relative_url }}">Browser Extension</a>+ <a href="{{ '/mobile-app/' | relative_url }}">Mobile App</a>+ </div>+</div>\ No newline at end of filediff --git a/docs/Gemfile b/docs/Gemfileindex 50943fbdc..28b874301 100644--- a/docs/Gemfile+++ b/docs/Gemfile@@ -6,3 +6,7 @@ gem "just-the-docs"# If you want to use GitHub Pages, remove the "gem "jekyll"" above and# uncomment the line below. To upgrade, run `bundle update github-pages`.gem "github-pages", group: :jekyll_plugins++group :jekyll_plugins do+ gem "jekyll-sitemap"+enddiff --git a/docs/Gemfile.lock b/docs/Gemfile.lockindex f68708513..a385a6e8f 100644--- a/docs/Gemfile.lock+++ b/docs/Gemfile.lock@@ -284,6 +284,7 @@ PLATFORMSDEPENDENCIESgithub-pages+ jekyll-sitemapjust-the-docsBUNDLED WITHdiff --git a/docs/_config.yml b/docs/_config.ymlindex 49a75843d..19d161758 100644--- a/docs/_config.yml+++ b/docs/_config.yml@@ -41,3 +41,15 @@ callouts:important:title: Importantcolor: yellow++# 404 page+defaults:+ - scope:+ path: "404.html"+ values:+ sitemap: false++# Sitemap settings+url: "https://docs.aliasvault.net"+plugins:+ - jekyll-sitemapdiff --git a/docs/_plugins/404_server.rb b/docs/_plugins/404_server.rbnew file mode 100644index 000000000..032522873--- /dev/null+++ b/docs/_plugins/404_server.rb@@ -0,0 +1,44 @@+require 'webrick'++module Jekyll+ class FourOhFourPage < StaticFile+ def write(dest)+ true+ end+ end++ class FourOhFourGenerator < Generator+ priority :low++ def generate(site)+ site.static_files << FourOhFourPage.new(site, site.dest, '/', '404.html')+ end+ end+end++# Override WEBrick to serve 404.html for missing files+if defined?(WEBrick)+ module WEBrick+ class HTTPServlet::FileHandler+ alias_method :do_GET_original, :do_GET++ def do_GET(req, res)+ do_GET_original(req, res)+ rescue HTTPStatus::NotFound => ex+ return_404_page(req, res)+ rescue => ex+ raise ex+ end++ def return_404_page(req, res)+ path = File.join(@config[:DocumentRoot], '404.html')+ if File.exist?(path)+ res.body = File.read(path)+ res['content-type'] = 'text/html'+ else+ raise HTTPStatus::NotFound+ end+ end+ end+ end+end\ No newline at end of file