Files
monotab/lib/layouts/root_layout.ex

62 lines
1.7 KiB
Elixir

defmodule MonoTab.RootLayout do
use Tableau.Layout
use Phoenix.Component
def template(assigns) do
~H"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http_equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
{[@page[:title], "MonoTab Blog"]
|> Enum.filter(& &1)
|> Enum.intersperse("|")
|> Enum.join(" ")}
</title>
<link rel="stylesheet" href="./css/mono.css" />
<link rel="stylesheet" href="./css/responsive.css" />
<meta
name="description"
content={@page[:description] || "A simple blog built with Elixir and Tableau"}
/>
</head>
<body class="mono-all">
<aside>
<nav>
<h1><a href="/">MonoTab Blog</a></h1>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/posts">Posts</a></li>
<li><a href="/about">About</a></li>
</ul>
</nav>
</aside>
<main>
{render(@inner_content)}
<footer>
<p>
&copy; {Date.utc_today().year} MonoTab Blog. Built with
<a href="https://github.com/artalar/mono" target="_blank">Mono</a>
and <a href="https://github.com/elixir-tools/tableau" target="_blank">Tableau</a>
</p>
</footer>
</main>
</body>
<%= if Mix.env() == :dev do %>
{Phoenix.HTML.raw(Tableau.live_reload(assigns))}
<% end %>
</html>
"""
|> Phoenix.HTML.Safe.to_iodata()
end
end