Skip to content

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

Change home destination

Uku Tahtbb765f9c0ca9
diff --git a/lib/plausible_web/templates/error/error.html.eex b/lib/plausible_web/templates/error/error.html.eex
index 16c87cc839..166198293a 100644
--- a/lib/plausible_web/templates/error/error.html.eex
+++ b/lib/plausible_web/templates/error/error.html.eex
@@ -13,7 +13,7 @@
<div class="container text-center mt-24">
<h1 class="text-5xl font-black"><%= @status %></h1>
<div class="my-4 text-xl"><%= @message %></div>
- <%= link("Go to the homepage", to: "/", class: "button mt-4") %>
+ <%= link("Go to the homepage", to: home_dest(@conn), class: "button mt-4") %>
</div>
</body>
</html>
diff --git a/lib/plausible_web/templates/layout/app.html.eex b/lib/plausible_web/templates/layout/app.html.eex
index 34a0e6690f..00bee5cb48 100644
--- a/lib/plausible_web/templates/layout/app.html.eex
+++ b/lib/plausible_web/templates/layout/app.html.eex
@@ -15,7 +15,7 @@
<%= render("_svg_icons.html") %>
<nav class="container flex items-center justify-between flex-wrap py-8">
<div class="flex items-center flex-shrink-0">
- <a href="/">
+ <a href="<%= home_dest(@conn) %>">
<%= img_tag(PlausibleWeb.Router.Helpers.static_path(@conn, "/images/icon/plausible_logo.png"), style: "height: 2.5rem;", alt: "Plausible logo") %>
</a>
</div>
diff --git a/lib/plausible_web/templates/layout/focus.html.eex b/lib/plausible_web/templates/layout/focus.html.eex
index 45932112af..610820eb16 100644
--- a/lib/plausible_web/templates/layout/focus.html.eex
+++ b/lib/plausible_web/templates/layout/focus.html.eex
@@ -13,7 +13,7 @@
<body class="flex flex-col h-full bg-gray-100">
<%= render("_svg_icons.html") %>
<div class="text-center w-full my-8">
- <a href="/">
+ <a href="<%= home_dest(@conn) %>">
<%= img_tag(PlausibleWeb.Router.Helpers.static_path(@conn, "/images/icon/plausible_logo.png"), class: "inline", style: "height: 2.5rem;", alt: "Plausible logo") %>
</a>
</div>
diff --git a/lib/plausible_web/views/layout_view.ex b/lib/plausible_web/views/layout_view.ex
index a62957b502..d6b88480b9 100644
--- a/lib/plausible_web/views/layout_view.ex
+++ b/lib/plausible_web/views/layout_view.ex
@@ -1,6 +1,14 @@
defmodule PlausibleWeb.LayoutView do
use PlausibleWeb, :view
+ def home_dest(conn) do
+ if conn.assigns[:current_user] do
+ "/sites"
+ else
+ "/"
+ end
+ end
+
def trial_notificaton(user) do
case Plausible.Billing.trial_days_left(user) do
days when days > 1 ->