feat: add support for custom page titles #12

Merged
gargakshit merged 3 commits from feature/title into develop 2022-05-28 05:10:07 +00:00
2 changed files with 7 additions and 2 deletions
Showing only changes of commit 5820652ac1 - Show all commits

View File

@ -28,7 +28,8 @@ defmodule KetbinWeb.PageController do
render(conn, "show.html", render(conn, "show.html",
paste: paste, paste: paste,
show_edit: show_edit, show_edit: show_edit,
extension: List.first(tail) || "" extension: List.first(tail) || "",
page_title: paste.id
) )
end end
end end

View File

@ -4,7 +4,11 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Katbin</title> <%= if Map.has_key?(assigns, :page_title) do %>
<title>Katbin - <%= @page_title %></title>
<% else %>
<title>Katbin</title>
<% end %>
<link rel="stylesheet" href={ Routes.static_path(@conn, "/assets/app.css") }/> <link rel="stylesheet" href={ Routes.static_path(@conn, "/assets/app.css") }/>
<script defer type="text/javascript" src={ Routes.static_path(@conn, "/assets/app.js") }></script> <script defer type="text/javascript" src={ Routes.static_path(@conn, "/assets/app.js") }></script>
</head> </head>