website/lib/layouts/root_layout.ex

59 lines
1.7 KiB
Elixir

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" />
<!-- optional javascript: only used for highlighting active page in nav -->
<script type="text/javascript" src="/js/site.js" />
</head>
<body>
<header>
<nav>
<a class="nav-link" href="/">Home</a>
<a class="nav-link" href="/about">About</a>
<a class="nav-link" href="/blog">Blog</a>
<a class="nav-link" href="/projects">Projects</a>
<sitename>
<h1><a href="#"><%= @page[:title] %></a></h1>
</sitename>
</nav>
</header>
<main>
<%= render(@inner_content) %>
</main>
<footer>
<nav>
<a href="https://code.criminallycute.fi/CriminallyCute/website">source</a>
<a class="underline" href="/feed.xml">RSS</a>
<copyright>
&copy; <%= Date.utc_today().year %> Criminally Cute
</copyright>
</nav>
</footer>
</body>
</html>
<%= if Mix.env() == :dev do %>
<%= Phoenix.HTML.raw(Tableau.live_reload(assigns)) %>
<% end %>
"""
|> Phoenix.HTML.Safe.to_iodata()
end
end