Make page titles consistent with application structure

- All existing pages get a nice title
- Suffix is "Music Library"
- Fallback is current request path
This commit is contained in:
Claudio Ortolina
2024-10-15 17:32:59 +01:00
parent cac644e563
commit 69e6cc67a2
2 changed files with 5 additions and 3 deletions
@@ -4,8 +4,8 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} />
<.live_title suffix=" · Phoenix Framework">
<%= assigns[:page_title] || "MusicLibrary" %>
<.live_title suffix=" · Music Library">
<%= assigns[:page_title] || assigns.conn.request_path %>
</.live_title>
<link rel="preconnect" href="https://rsms.me/" />
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
@@ -15,7 +15,9 @@ defmodule MusicLibraryWeb.StatsController do
records_count = Enum.reduce(records_count_by_format, 0, fn {_, count}, acc -> acc + count end)
latest_record = Records.get_latest_record!()
render(conn, :index,
conn
|> assign(:page_title, "Stats")
|> render(:index,
records_count_by_format: records_count_by_format,
records_count_by_type: records_count_by_type,
records_count: records_count,