add source code to footer, remove unneeded layouts

This commit is contained in:
2025-07-26 15:09:57 -04:00
parent bc8bcfe9b3
commit 1fcc40d21d
12 changed files with 75 additions and 68 deletions

View File

@@ -6,9 +6,7 @@ defmodule MonoTab.IndexLayout do
~H"""
<h1>{@page[:title] || "Latest Posts"}</h1>
<%= if @page[:description] do %>
<p>{@page[:description]}</p>
<% end %>
{{:safe, render(@inner_content)}}
<%= if assigns[:posts] && length(@posts) > 0 do %>
<ul>
@@ -27,8 +25,6 @@ defmodule MonoTab.IndexLayout do
<% else %>
<p>No posts found.</p>
<% end %>
{{:safe, render(@inner_content)}}
"""
end

View File

@@ -5,19 +5,6 @@ defmodule MonoTab.PostLayout do
def template(assigns) do
~H"""
{{:safe, render(@inner_content)}}
<%= if @page[:date] do %>
<time datetime={@page[:date]}>{format_date(@page[:date])}</time>
<% end %>
"""
end
defp format_date(date_string) when is_binary(date_string) do
case Date.from_iso8601(date_string) do
{:ok, date} -> Calendar.strftime(date, "%B %d, %Y")
{:error, _} -> date_string
end
end
defp format_date(%Date{} = date), do: Calendar.strftime(date, "%B %d, %Y")
defp format_date(_), do: ""
end

View File

@@ -44,10 +44,16 @@ defmodule MonoTab.RootLayout do
<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>
<a href="https://github.com/elixir-tools/tableau" target="_blank">Tableau</a>
and <a href="https://github.com/artalar/mono" target="_blank">Mono</a>
<br />
</p>
</footer>
<p class="footer-extra">
<a href="https://git.silentsilas.com/silentsilas/monotab" target="_blank">
Source Code
</a>
</p>
</main>
</body>