Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Add login link to 404 page (#3288)

Uku Tahtda3d4366f693
diff --git a/assets/css/app.css b/assets/css/app.css
index 298eaf64af..11a3951888 100644
--- a/assets/css/app.css
+++ b/assets/css/app.css
@@ -22,6 +22,10 @@
@apply text-indigo-600 bg-transparent border border-indigo-600;
}
+.button-outline:hover {
+ @apply text-white;
+}
+
.button-sm {
@apply px-4 py-2 text-sm;
}
diff --git a/lib/plausible_web/templates/error/404_error.html.eex b/lib/plausible_web/templates/error/404_error.html.eex
new file mode 100644
index 0000000000..648ca14777
--- /dev/null
+++ b/lib/plausible_web/templates/error/404_error.html.eex
@@ -0,0 +1,9 @@
+<div class="container flex flex-col items-center text-center mt-24">
+ <h1 class="text-5xl font-black dark:text-gray-100"><%= @status %></h1>
+ <div class="mt-4 text-xl dark:text-gray-100">Oops! There's nothing here</div>
+ <div class="text-xl dark:text-gray-100">Trying to access your dashboard? You may need to log in again to see it</div>
+ <div class="mt-6 flex">
+ <%= link("Login", to: Routes.auth_path(@conn, :login_form), class: "button") %>
+ <%= link("Go to homepage", to: PlausibleWeb.LayoutView.home_dest(@conn), class: "button button-outline ml-2") %>
+ </div>
+</div>
diff --git a/lib/plausible_web/views/error_view.ex b/lib/plausible_web/views/error_view.ex
index 2a2f8b78bd..1299731c13 100644
--- a/lib/plausible_web/views/error_view.ex
+++ b/lib/plausible_web/views/error_view.ex
@@ -14,7 +14,7 @@ defmodule PlausibleWeb.ErrorView do
|> Map.put(:status, 404)
|> Map.put_new(:message, "Oops! There's nothing here")
- render("generic_error.html", assigns)
+ render("404_error.html", assigns)
end
def render(<<"5", _error_5xx::binary-size(2), ".html">>, assigns) do
diff --git a/test/plausible_web/controllers/stats_controller_test.exs b/test/plausible_web/controllers/stats_controller_test.exs
index 70330665ce..132072759a 100644
--- a/test/plausible_web/controllers/stats_controller_test.exs
+++ b/test/plausible_web/controllers/stats_controller_test.exs
@@ -45,7 +45,7 @@ defmodule PlausibleWeb.StatsControllerTest do
test "can not view stats of a private website", %{conn: conn} do
conn = get(conn, "/test-site.com")
- assert html_response(conn, 404) =~ "There&#39;s nothing here"
+ assert html_response(conn, 404) =~ "There's nothing here"
end
end
@@ -67,7 +67,7 @@ defmodule PlausibleWeb.StatsControllerTest do
test "can not view stats of someone else's website", %{conn: conn} do
site = insert(:site)
conn = get(conn, "/" <> site.domain)
- assert html_response(conn, 404) =~ "There&#39;s nothing here"
+ assert html_response(conn, 404) =~ "There's nothing here"
end
end