Add breadcrumbs to views: page, article (#14)
This commit is contained in:
parent
ebff42d899
commit
fae04e3fd7
3 changed files with 54 additions and 19 deletions
|
|
@ -50,12 +50,18 @@ defmodule Mse25Web.ItemController do
|
|||
"pubDate" => published_at,
|
||||
"date_updated" => updated_at
|
||||
}) do
|
||||
updated =
|
||||
case updated_at do
|
||||
nil -> published_at
|
||||
s -> String.slice(s, 0..9)
|
||||
end
|
||||
|
||||
[
|
||||
heading: heading,
|
||||
contents: Earmark.as_html!(contents),
|
||||
published_at: published_at,
|
||||
updated_at: updated_at,
|
||||
year: 2024
|
||||
updated_at: updated,
|
||||
year: String.slice(published_at, 0..3)
|
||||
]
|
||||
end
|
||||
|
||||
|
|
@ -98,7 +104,7 @@ defmodule Mse25Web.ItemController do
|
|||
[
|
||||
heading: heading,
|
||||
contents: Earmark.as_html!(contents),
|
||||
updated_at: updated_at
|
||||
updated_at: String.slice(updated_at, 0..9)
|
||||
]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,12 +1,33 @@
|
|||
<article>
|
||||
<article class="article">
|
||||
<header>
|
||||
<date><%= @published_at %></date>
|
||||
<ol class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">
|
||||
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
<a href="/" rel="home">
|
||||
<span itemprop="name">madr.se</span>
|
||||
</a>
|
||||
<meta itemprop="position" content="1" />
|
||||
</li>
|
||||
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
<a href="/webblogg">
|
||||
<span itemprop="name">Webblogg</span>
|
||||
</a>
|
||||
<meta itemprop="position" content="2" />
|
||||
</li>
|
||||
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
<a href={"/" <> @year}>
|
||||
<span itemprop="name"><%= @year %></span>
|
||||
</a>
|
||||
<meta itemprop="position" content="3" />
|
||||
</li>
|
||||
</ol>
|
||||
<h1><%= @heading %></h1>
|
||||
</header>
|
||||
|
||||
<%= raw @contents %>
|
||||
<%= raw(@contents) %>
|
||||
|
||||
<footer>
|
||||
<p>Skribent: Anders Englöf Ytterström. Publicerad <%= @published_at %> och senast uppdaterad <%= @updated_at %>.</p>
|
||||
<p>
|
||||
Publicerad <%= @published_at %> <br />och senast uppdaterad <%= @updated_at %>
|
||||
</p>
|
||||
</footer>
|
||||
</article>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,19 @@
|
|||
<article>
|
||||
<header>
|
||||
<ol class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">
|
||||
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
<a href="/" rel="home">
|
||||
<span itemprop="name">madr.se</span>
|
||||
</a>
|
||||
<meta itemprop="position" content="1" />
|
||||
</li>
|
||||
</ol>
|
||||
<h1><%= @heading %></h1>
|
||||
</header>
|
||||
|
||||
<%= raw @contents %>
|
||||
<%= raw(@contents) %>
|
||||
|
||||
<footer>
|
||||
<p>Skribent: Anders Englöf Ytterström. Senast uppdaterad <%= @updated_at %>.</p>
|
||||
<p>Senast uppdaterad <%= @updated_at %></p>
|
||||
</footer>
|
||||
</article>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue