website/lib/layouts/root_layout.ex

61 lines
1.5 KiB
Elixir
Raw Normal View History

defmodule Website.RootLayout do
use Tableau.Layout
use Phoenix.Component
def template(assigns) do
~H"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- meta name="color-scheme" content="dark light" /-->
<title>
<%= [@page[:title], "Criminally Cute"]
|> Enum.filter(& &1)
|> Enum.intersperse("|")
|> Enum.join(" ") %>
</title>
<link rel="icon" type="image/png" href="/favicon.png" />
<link rel="stylesheet" href="/css/site.css" />
</head>
<body>
<header>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
<li><a href="/blog">Blog</a></li>
<li><a href="/projects">Projects</a></li>
</ul>
</nav>
<div>
<h1><%= @page[:title] %></h1>
</div>
</header>
<main>
<%= render(@inner_content) %>
</main>
<footer>
<ul>
<li>some link</li>
<li>some link 2</li>
</ul>
<div>
<p>&copy; <%= Date.utc_today().year %> Criminally Cute</p>
<p><a class="underline" href="/feed.xml">RSS</a></p>
</div>
</footer>
</body>
</html>
<%= if Mix.env() == :dev do %>
<%= Phoenix.HTML.raw(Tableau.live_reload(assigns)) %>
<% end %>
"""
|> Phoenix.HTML.Safe.to_iodata()
end
end