From 57e935ec00876dd32fde5ed022db17d74ad214c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Anders=20Engl=C3=B6f=20Ytterstr=C3=B6m?=
Date: Wed, 16 Oct 2024 15:40:53 +0200
Subject: [PATCH] Improve HTML for robot consumtion (#24)
* Fix icalendar validation errors
* Add RSS feed to documents
* Add stuff to meta: opengraph, canonical
* Add SEO robots meta elements
* Fix correct page titles
* Add more semantics to HTML
* Remove breadcrumbs from templates
* Render breadcrumbs in layout
Each controller should provide their own breadcrumb
trail as a list of tuples, where each tuple is the
pair of a slugified key and a human readable label.
Example:
[{"blog", "Webblogg"}]
[{"blog", "Webblogg"}, "2024", "2024"]
* Add CSS util class to show content only to screen readers
* Load interactive event map only on events page
* Decrease home logo size
* Use correct HTML element for time
* Improve Home page HTML semantics
* Add Person RFDa to footer
* Add RDFa to articles: annual, item, articles
* Enrich links semantics using RDFa
* Enrich Page semantics using RDFa
* Enrich Album semantics using RFDa
* Enrich Event semantics with RDFa
---
assets/app.css | 5 +
lib/mse25/directus.ex | 36 +++-
lib/mse25/event_helpers.ex | 21 +-
lib/mse25_web/components/layouts.ex | 118 +++++++++-
.../components/layouts/app.html.heex | 38 +++-
.../components/layouts/root.html.heex | 17 +-
lib/mse25_web/controllers/feed_controller.ex | 5 +
lib/mse25_web/controllers/feed_view.ex | 29 ++-
lib/mse25_web/controllers/item_controller.ex | 37 +++-
.../controllers/item_html/album.html.heex | 37 ++--
.../controllers/item_html/annual.html.heex | 203 +++++++++---------
.../controllers/item_html/article.html.heex | 34 +--
.../controllers/item_html/event.html.heex | 53 ++---
.../controllers/item_html/link.html.heex | 41 +---
.../controllers/item_html/page.html.heex | 22 +-
lib/mse25_web/controllers/page_controller.ex | 17 +-
.../controllers/page_html/articles.html.heex | 88 ++++----
.../controllers/page_html/events.html.heex | 28 +--
.../controllers/page_html/home.html.heex | 58 ++---
.../controllers/page_html/links.html.heex | 136 ++++++------
.../controllers/page_html/search.html.heex | 145 ++++++-------
21 files changed, 648 insertions(+), 520 deletions(-)
diff --git a/assets/app.css b/assets/app.css
index 3d36894..c50bf72 100644
--- a/assets/app.css
+++ b/assets/app.css
@@ -81,6 +81,11 @@ section {
}
}
+.sr-only {
+ position: absolute;
+ left: -999em;
+}
+
.flx {
display: flex;
justify-content: space-between;
diff --git a/lib/mse25/directus.ex b/lib/mse25/directus.ex
index 6e2fb25..de29435 100644
--- a/lib/mse25/directus.ex
+++ b/lib/mse25/directus.ex
@@ -43,16 +43,30 @@ defmodule Mse25.Directus do
end
def get_album(externalId) do
- get_item(
- :albums,
- externalId,
- [
- "*",
- "songs.title",
- "songs.artist.name"
- ]
- |> Enum.join(",")
- )
+ case get_item(
+ :albums,
+ externalId,
+ [
+ "*",
+ "songs.title",
+ "songs.artist.name"
+ ]
+ |> Enum.join(",")
+ ) do
+ {:ok,
+ data = %{
+ "album" => album,
+ "year" => year,
+ "songs" => [%{"artist" => %{"name" => artist}} | _]
+ }} ->
+ {:ok,
+ data
+ |> Map.put("artist", artist)
+ |> Map.put("summary", "#{artist} - #{album} (#{to_string(year)})")}
+
+ not_found ->
+ not_found
+ end
end
def get_albums!(options \\ []) do
@@ -120,6 +134,7 @@ defmodule Mse25.Directus do
"fields=" <>
Enum.join(
[
+ "id",
"title",
"lead",
"slug",
@@ -128,6 +143,7 @@ defmodule Mse25.Directus do
"started_at",
"ended_at",
"contents",
+ "date_created",
"bands.artists_id.name",
"mia.artists_id.name",
"location.*"
diff --git a/lib/mse25/event_helpers.ex b/lib/mse25/event_helpers.ex
index 20fb630..d040cad 100644
--- a/lib/mse25/event_helpers.ex
+++ b/lib/mse25/event_helpers.ex
@@ -1,11 +1,4 @@
defmodule Mse25.EventHelpers do
- def bandlist(bands) do
- bands
- |> Enum.map(fn b -> b["artists_id"]["name"] end)
- |> Enum.join(", ")
- |> String.replace(~r/, ([^,]+?)$/, " och \\1")
- end
-
def hilights?(%{"bands" => bands, "category" => category}) do
_festival_band?(bands, category)
end
@@ -30,4 +23,18 @@ defmodule Mse25.EventHelpers do
def _festival_band?(_b, _c) do
false
end
+
+ def bandlist(bands) do
+ bands
+ |> Enum.map(fn b -> b["artists_id"]["name"] end)
+ |> Enum.join(", ")
+ |> String.replace(~r/, ([^,]+?)$/, " och \\1")
+ end
+
+ def rdfa_bandlist(bands) do
+ bands
+ |> Enum.map(fn b -> "#{b["artists_id"]["name"]} " end)
+ |> Enum.join(", ")
+ |> String.replace(~r/, ([^,]+?)$/, " och \\1")
+ end
end
diff --git a/lib/mse25_web/components/layouts.ex b/lib/mse25_web/components/layouts.ex
index 1715aac..5b68d48 100644
--- a/lib/mse25_web/components/layouts.ex
+++ b/lib/mse25_web/components/layouts.ex
@@ -1,14 +1,114 @@
defmodule Mse25Web.Layouts do
- @moduledoc """
- This module holds different layouts used by your application.
-
- See the `layouts` directory for all templates available.
- The "root" layout is a skeleton rendered as part of the
- application router. The "app" layout is set as the default
- layout on both `use Mse25Web, :controller` and
- `use Mse25Web, :live_view`.
- """
use Mse25Web, :html
+ @url "https://madr.se"
+ @list_views ["webblogg", "delningar", "evenemang"]
+
embed_templates "layouts/*"
+
+ def canonical(%{year: _, conn: %{path_info: path}}) do
+ ~s"""
+
+ """
+ end
+
+ def canonical(_) do
+ ""
+ end
+
+ def opengraph(%{heading: title, lead: lead, conn: %{path_info: path}}) do
+ ~s"""
+
+
+
+
+
+ """
+ end
+
+ def opengraph(%{heading: title, conn: %{path_info: path}}) do
+ ~s"""
+
+
+
+
+ """
+ end
+
+ def opengraph(%{page_title: title, conn: %{path_info: path}}) do
+ ~s"""
+
+
+
+
+ """
+ end
+
+ def robots(%{conn: %{path_info: [first | []]}}) do
+ case Integer.parse(first) do
+ :error ->
+ case Enum.member?(@list_views, first) do
+ true ->
+ ~s"""
+
+ """
+
+ false ->
+ ~s"""
+
+ """
+ end
+
+ {_i, _d} ->
+ ~s"""
+
+ """
+ end
+ end
+
+ def robots(%{conn: %{path_info: [_p, _c]}}) do
+ ~s"""
+
+ """
+ end
+
+ def robots(_) do
+ ~s"""
+
+ """
+ end
+
+ def breadcrumbs(nodes) do
+ breadcrumbs([], "", 1, nodes)
+ end
+
+ def breadcrumbs(seen, _path, _index, []) do
+ Enum.reverse(seen)
+ end
+
+ def breadcrumbs(seen, path, index, [{slug, name} | nodes]) do
+ breadcrumbs(
+ [{index + 1, {path <> "/" <> to_string(slug), name}} | seen],
+ path <> "/" <> to_string(slug),
+ index + 1,
+ nodes
+ )
+ end
+
+ def breadcrumbs(seen, path, index, [{slug, name, custom_prefix} | nodes]) do
+ breadcrumbs(
+ [{index + 1, {custom_prefix <> "/" <> to_string(slug), name}} | seen],
+ path <> "/" <> to_string(slug),
+ index + 1,
+ nodes
+ )
+ end
+
+ def show_interactive_event_map?(assigns) do
+ Map.has_key?(assigns, :events)
+ end
+
+ def show_footer?(%{heading: "Kolofon"}), do: false
+
+ def show_footer?(%{}), do: true
end
diff --git a/lib/mse25_web/components/layouts/app.html.heex b/lib/mse25_web/components/layouts/app.html.heex
index c753bc6..3c372c3 100644
--- a/lib/mse25_web/components/layouts/app.html.heex
+++ b/lib/mse25_web/components/layouts/app.html.heex
@@ -1,3 +1,39 @@
-
+Hoppa till innehållet
+
+
+
+
Du är här:
+
+
+
+ madr.se
+
+
+
+ <%= for {index, {parent_slug, parent_name}} <- breadcrumbs(@breadcrumbs) do %>
+ >
+
+
+ <%= parent_name %>
+
+
+
+ <% end %>
+
+
+
+
<%= @inner_content %>
+<%= if show_footer?(assigns) do %>
+
+
+ madr.se
+ är Anders Englöf Ytterström s hemsida. Anders är webbutvecklare , linuxentusiast, ljudtekniker och hårdrockare, bosatt i Borlänge (Dalarna ) .
+ Läs kolofonen .
+
+
+<% end %>
diff --git a/lib/mse25_web/components/layouts/root.html.heex b/lib/mse25_web/components/layouts/root.html.heex
index 6274a51..da5487e 100644
--- a/lib/mse25_web/components/layouts/root.html.heex
+++ b/lib/mse25_web/components/layouts/root.html.heex
@@ -4,12 +4,25 @@
- <%= assigns[:page_title] || "Anders Englöf Ytterström" %> | madr.se
+ <%= assigns.page_title || "Anders Englöf Ytterström" %> | madr.se
+
+ <%= canonical(assigns) |> raw %>
+ <%= opengraph(assigns) |> raw %>
+ <%= robots(assigns) |> raw %>
-
+
<%= @inner_content %>
+ <%= if show_interactive_event_map?(assigns) do %>
+
+ <% end %>
diff --git a/lib/mse25_web/controllers/feed_controller.ex b/lib/mse25_web/controllers/feed_controller.ex
index e4c702c..54c4462 100644
--- a/lib/mse25_web/controllers/feed_controller.ex
+++ b/lib/mse25_web/controllers/feed_controller.ex
@@ -19,10 +19,12 @@ defmodule Mse25Web.FeedController do
conn |> put_resp_content_type("text/calendar"),
Directus.get_events!(upcoming: true, limit: 9999)
|> Enum.map(fn %{
+ "id" => id,
"title" => title,
"lead" => lead,
"started_at" => starts_at,
"ended_at" => ends_at,
+ "date_created" => created_at,
"location" => %{
"name" => venue,
"address" => region,
@@ -32,6 +34,7 @@ defmodule Mse25Web.FeedController do
}
} ->
%{
+ id: id,
title: title,
lead: lead,
region: region,
@@ -39,6 +42,8 @@ defmodule Mse25Web.FeedController do
latitude: lat,
longitude: lng,
all_day?: true,
+ updated_at: created_at |> String.slice(0..18) |> String.replace(~r/[-:]/, ""),
+ created_at: created_at |> String.slice(0..18) |> String.replace(~r/[-:]/, ""),
starts_at: String.replace(starts_at, "-", ""),
ends_at: String.replace(ends_at, "-", "")
}
diff --git a/lib/mse25_web/controllers/feed_view.ex b/lib/mse25_web/controllers/feed_view.ex
index 6066dc6..57a5722 100644
--- a/lib/mse25_web/controllers/feed_view.ex
+++ b/lib/mse25_web/controllers/feed_view.ex
@@ -23,14 +23,31 @@ defmodule Mse25Web.FeedView do
~s"""
BEGIN:VCALENDAR
VERSION:2.0
- PRODID:-//https://madr.se//kommande-evenemang
+ PRODID:-//https://madr.se//kommande-evenemang.ics//SE
+ CALSCALE:GREGORIAN
+ X-ORIGINAL-URL:https://madr.se
+ X-WR-CALDESC: Kommande evenemang, madr.se
METHOD:PUBLISH
- #{upcoming |> Enum.map(fn %{title: title, starts_at: starts_at, ends_at: ends_at, longitude: longitude, latitude: latitude, lead: lead, venue: venue, region: region} -> ~s"""
+ REFRESH-INTERVAL;VALUE=DURATION:PT1H
+ X-Robots-Tag:noindex
+ X-PUBLISHED-TTL:PT1H
+ BEGIN:VTIMEZONE
+ TZID:CEST
+ BEGIN:STANDARD
+ TZOFFSETFROM:+0200
+ TZOFFSETTO:+0200
+ TZNAME:CEST
+ DTSTART:20000630T000000
+ END:STANDARD
+ END:VTIMEZONE
+ #{upcoming |> Enum.map(fn %{id: id, title: title, created_at: created_at, starts_at: starts_at, ends_at: ends_at, longitude: longitude, latitude: latitude, lead: lead, venue: venue, region: region} -> ~s"""
BEGIN:VEVENT
- UID:#{title}.#{starts_at}@madr.se
- DTSTAMP:#{starts_at}T000000
- DTSTART;VALUE=DATE:#{starts_at}
- DTEND;VALUE=DATE:#{ends_at}
+ UID:#{starts_at}.#{id}@madr.se
+ DTSTAMP:#{created_at}
+ CREATED:#{created_at}
+ LAST-MODIFIED:#{created_at}
+ DTSTART;TZID=CEST:#{starts_at}T060606
+ DTEND;TZID=CEST:#{ends_at}T060606
SUMMARY:#{title}
DESCRIPTION:#{lead}
LOCATION:#{venue}\, #{region}
diff --git a/lib/mse25_web/controllers/item_controller.ex b/lib/mse25_web/controllers/item_controller.ex
index ecadecb..b9ed537 100644
--- a/lib/mse25_web/controllers/item_controller.ex
+++ b/lib/mse25_web/controllers/item_controller.ex
@@ -73,6 +73,7 @@ defmodule Mse25Web.ItemController do
do: [
year: year,
page_title: "Innehåll från " <> to_string(year),
+ breadcrumbs: [{year, year}],
timeline: timeline,
brutal_legends_count: Map.get(counts, :albums, 0),
article_count: Map.get(counts, :articles, 0),
@@ -86,8 +87,11 @@ defmodule Mse25Web.ItemController do
"pubDate" => published_at,
"date_updated" => updated_at
}) do
+ year = String.slice(published_at, 0..3)
+
[
page_title: heading,
+ breadcrumbs: [{"webblogg", "Webblogg"}, {year, year, ""}],
heading: heading,
contents: Earmark.as_html!(contents),
published_at: published_at,
@@ -96,7 +100,7 @@ defmodule Mse25Web.ItemController do
nil -> published_at
ua -> String.slice(ua, 0..9)
end,
- year: String.slice(published_at, 0..3)
+ year: year
]
end
@@ -104,22 +108,28 @@ defmodule Mse25Web.ItemController do
"title" => heading,
"contents" => contents,
"started_at" => started_at,
+ "ended_at" => ended_at,
"lead" => lead,
"poster" => poster,
"bands" => bands,
"mia" => mia,
"category" => category
}) do
+ year = String.slice(started_at, 0..3)
+
[
page_title: heading,
+ breadcrumbs: [{"evenemang", "Evenemang"}, {year, year, ""}],
heading: heading,
contents: Earmark.as_html!(contents),
lead: lead,
- year: String.slice(started_at, 0..3),
+ year: year,
poster: poster,
bands: bands,
mia: mia,
- category: category
+ category: category,
+ started_at: started_at,
+ ended_at: ended_at
]
end
@@ -131,14 +141,17 @@ defmodule Mse25Web.ItemController do
"source" => url,
"h1" => title
}) do
+ year = String.slice(published_at, 0..3)
+
[
page_title: heading,
+ breadcrumbs: [{"delningar", "Delningar"}, {year, year, ""}],
heading: heading,
contents: Earmark.as_html!(contents),
published_at: published_at,
url: url,
title: title,
- year: String.slice(published_at, 0..3),
+ year: year,
updated_at:
case updated_at do
nil -> published_at
@@ -153,6 +166,8 @@ defmodule Mse25Web.ItemController do
"date_updated" => updated_at
}) do
[
+ page_title: heading,
+ breadcrumbs: [],
heading: heading,
contents: Earmark.as_html!(contents),
updated_at: String.slice(updated_at, 0..9)
@@ -166,18 +181,24 @@ defmodule Mse25Web.ItemController do
"cover" => cover,
"purchased_at" => purchased_at,
"externalId" => count,
- "songs" => songs
+ "songs" => songs,
+ "summary" => summary,
+ "artist" => artist
}) do
+ purchase_year = String.slice(purchased_at, 0..3)
+
[
+ page_title: summary,
+ breadcrumbs: [{purchase_year, purchase_year}],
count: count,
- page_title: album,
album: album,
cover: cover,
year: to_string(year),
- purchase_year: String.slice(purchased_at, 0..3),
+ purchase_year: purchase_year,
contents: Earmark.as_html!(contents),
songs: Enum.map(songs, fn %{"title" => name} -> "\"" <> name <> "\"" end),
- artist: List.first(songs) |> Map.get("artist") |> Map.get("name")
+ artist: artist,
+ summary: summary
]
end
end
diff --git a/lib/mse25_web/controllers/item_html/album.html.heex b/lib/mse25_web/controllers/item_html/album.html.heex
index 352bfd3..96bd78c 100644
--- a/lib/mse25_web/controllers/item_html/album.html.heex
+++ b/lib/mse25_web/controllers/item_html/album.html.heex
@@ -1,21 +1,7 @@
-
-
+
+
+ <%= @summary %>
+
Som jag tidigare skrivit om har jag ett roligt projekt pågående: att äga alla låtar i spelet Brütal Legend äldre än 1990 på vinyl, där det är möjligt.
@@ -23,18 +9,23 @@
- #<%= @count %>: <%= @artist %> - <%= csl(@songs) %>, från <%= @album %> (<%= @year %>)
+ #<%= @count %>: <%= @artist %>
+ - <%= csl(@songs) %>, från <%= @album %>
+ (<%= @year %> )
<%= if @cover do %>
@cover <> "?key=rectangular"}
+ property="image"
+ src={"https://n.madr.se/assets/" <> @cover <> "?key=cover"}
alt="Skivomslag"
loading="lazy"
- height="75"
- width="75"
+ height="333"
+ width="333"
/>
<% end %>
- <%= raw(@contents) %>
+
+ <%= raw(@contents) %>
+
diff --git a/lib/mse25_web/controllers/item_html/annual.html.heex b/lib/mse25_web/controllers/item_html/annual.html.heex
index 0435525..3f43771 100644
--- a/lib/mse25_web/controllers/item_html/annual.html.heex
+++ b/lib/mse25_web/controllers/item_html/annual.html.heex
@@ -1,108 +1,107 @@
-
-
-
-
- madr.se
-
-
+<%= @page_title %>
+
+
+ <%= if @link_count > 0 do %>
+ <%= @link_count %> länkar värda att uppmärksamma och kommentera
+ <% end %>
+ <%= if @article_count > 0 do %>
+ <%= @article_count %> inlägg i webbloggen
+ <% end %>
+ <%= if @event_count > 0 do %>
+ <%= @event_count %> besökta evenemang
+ <% end %>
+ <%= if @brutal_legends_count > 0 do %>
+
+ <%= @brutal_legends_count %>
+ <%= if @brutal_legends_count == 1 do %>
+ köpt vinylskiva
+ <% else %>
+ köpta vinylskivor
+ <% end %>
+ till Brütal Legend-samlingen
-
- <%= @page_title %>
-
-
- <%= if @link_count > 0 do %>
- <%= @link_count %> länkar värda att uppmärksamma och kommentera
- <% end %>
- <%= if @article_count > 0 do %>
- <%= @article_count %> inlägg i webbloggen
- <% end %>
- <%= if @event_count > 0 do %>
- <%= @event_count %> besökta evenemang
- <% end %>
- <%= if @brutal_legends_count > 0 do %>
-
- <%= @brutal_legends_count %>
- <%= if @brutal_legends_count == 1 do %>
- köpt vinylskiva
- <% else %>
- köpta vinylskivor
- <% end %>
- till Brütal Legend-samlingen
-
- <% end %>
-
- <%= for {month, items} <- @timeline do %>
- month}>
- <%= month_name(month) <> ", " <> to_string(@year) %>
- <%= for item = %{t: t} <- items do %>
-
- <%= if t == :articles do %>
-
- <% end %>
- <%= if t == :events do %>
-
- <%= item["lead"] %>
- <%= if item["poster"] do %>
- item["poster"] <> "?key=poster"}
- loading="lazy"
- alt="Affisch"
- width="200"
- />
- <% end %>
- <% end %>
- <%= if t == :links do %>
-
+ <% end %>
+
+<%= for {month, items} <- @timeline do %>
+ month}>
+ <%= month_name(month) <> ", " <> to_string(@year) %>
+ <%= for item = %{t: t} <- items do %>
+ <%= if t == :articles do %>
+
+
- <%= raw(Earmark.as_html!(item["contents"])) %>
- Källa:
- item["source"]}>
- <%= item["h1"] %>
- <% end %>
- <%= if t == :albums do %>
-
- <%= if item["contents"] do %>
- <%= raw(Earmark.as_html!(item["contents"])) %>
- <% end %>
-
- <%= for song <- item["songs"] do %>
- <%= song["artist"]["name"] <> " - " <> song["title"] %>
- <% end %>
-
- <%= if item["cover"] do %>
- item["cover"] <> "?key=rectangular"}
- alt="Skivomslag"
- loading="lazy"
- height="75"
- width="75"
- />
- <% end %>
+
+ <%= item["pubDate"] %>
+
+ <% end %>
+ <%= if t == :events do %>
+
+
+ <%= item["lead"] %>
+ <%= if item["poster"] do %>
+ item["poster"] <> "?key=poster"}
+ loading="lazy"
+ alt="Affisch"
+ width="200"
+ />
<% end %>
<% end %>
-
- <% end %>
-
+ <%= if t == :links do %>
+
+
+
+ <%= item["contents"] |> Earmark.as_html!() |> raw %>
+
+
+
+ <% end %>
+ <%= if t == :albums do %>
+
+
+
+ <%= for song <- item["songs"] do %>
+ <%= song["artist"]["name"] <> " - " <> song["title"] %>
+ <% end %>
+
+ <%= if item["cover"] do %>
+ item["cover"] <> "?key=rectangular"}
+ alt="Skivomslag"
+ loading="lazy"
+ height="75"
+ width="75"
+ />
+ <% end %>
+
+ <% end %>
+ <% end %>
+
+<% end %>
diff --git a/lib/mse25_web/controllers/item_html/article.html.heex b/lib/mse25_web/controllers/item_html/article.html.heex
index da52f9c..7c53f8f 100644
--- a/lib/mse25_web/controllers/item_html/article.html.heex
+++ b/lib/mse25_web/controllers/item_html/article.html.heex
@@ -1,33 +1,15 @@
-
-
+
+ <%= @heading %>
- <%= raw(@contents) %>
+
+ <%= raw(@contents) %>
+
diff --git a/lib/mse25_web/controllers/item_html/event.html.heex b/lib/mse25_web/controllers/item_html/event.html.heex
index f762f1c..f84af3a 100644
--- a/lib/mse25_web/controllers/item_html/event.html.heex
+++ b/lib/mse25_web/controllers/item_html/event.html.heex
@@ -1,45 +1,38 @@
-
-
+
+ <%= @heading %>
- <%= @lead %>
+ <%= @lead %>
+
+ <%= @started_at %> –<%= @ended_at %>
+
<%= if opening_acts?(%{"bands" => @bands, "category" => @category}) do %>
- Huvudakt: <%= @bands |> List.first() |> Map.get("artists_id") |> Map.get("name") %>
- Förband: <%= @bands |> Enum.drop(1) |> bandlist() %>
+
+ Huvudakt:
+
+ <%= @bands |> List.first() |> Map.get("artists_id") |> Map.get("name") %>
+
+
+ Förband: <%= @bands |> Enum.drop(1) |> rdfa_bandlist() |> raw %>
<% end %>
<%= if hilights?(%{"bands" => @bands, "category" => @category}) do %>
- Personliga höjdpunkter: <%= @bands |> bandlist() %>
+ Personliga höjdpunkter: <%= @bands |> rdfa_bandlist() |> raw %>
<% end %>
<%= if missed?(%{"mia" => @mia, "category" => @category}) do %>
Band jag missade: <%= @mia |> bandlist() %>
<% end %>
- <%= raw(@contents) %>
+
+ <%= raw(@contents) %>
+
<%= if @poster do %>
- @poster} alt="affisch" loading="lazy" />
+ @poster <> "?key=poster"}
+ alt="affisch"
+ loading="lazy"
+ />
<% end %>
diff --git a/lib/mse25_web/controllers/item_html/link.html.heex b/lib/mse25_web/controllers/item_html/link.html.heex
index 0df57c5..c531354 100644
--- a/lib/mse25_web/controllers/item_html/link.html.heex
+++ b/lib/mse25_web/controllers/item_html/link.html.heex
@@ -1,35 +1,16 @@
-
-
-
- <%= raw(@contents) %>
-
- Källa: <%= @title %>
-
+
+ <%= @heading %>
+
+ <%= raw(@contents) %>
+
+
diff --git a/lib/mse25_web/controllers/item_html/page.html.heex b/lib/mse25_web/controllers/item_html/page.html.heex
index e331511..58707db 100644
--- a/lib/mse25_web/controllers/item_html/page.html.heex
+++ b/lib/mse25_web/controllers/item_html/page.html.heex
@@ -1,19 +1,13 @@
-
-
+
+ <%= @heading %>
- <%= raw(@contents) %>
+
+ <%= raw(@contents) %>
+
diff --git a/lib/mse25_web/controllers/page_controller.ex b/lib/mse25_web/controllers/page_controller.ex
index 3d1f72a..5137477 100644
--- a/lib/mse25_web/controllers/page_controller.ex
+++ b/lib/mse25_web/controllers/page_controller.ex
@@ -38,6 +38,7 @@ defmodule Mse25Web.PageController do
render(conn, :search,
q: query,
+ breadcrumbs: [],
page_title: scount <> " sökresultat för \"" <> query <> "\"",
results: results
)
@@ -48,19 +49,20 @@ defmodule Mse25Web.PageController do
end
def articles(conn, params) do
- articles =
+ {articles, page_title} =
case params do
%{"q" => query_string} ->
- Directus.get_articles!(limit: @almost_infinity, query: query_string)
+ {Directus.get_articles!(limit: @almost_infinity, query: query_string),
+ "Webblogg: \"#{query_string}\""}
_ ->
- Directus.get_articles!(limit: @almost_infinity)
+ {Directus.get_articles!(limit: @almost_infinity), "Webblogg"}
end
- |> group_annually
render(conn, :articles,
- page_title: "Webblogg",
- articles: articles,
+ page_title: page_title,
+ breadcrumbs: [{"webblogg", "Webblogg"}],
+ articles: group_annually(articles),
q: params["q"],
nosearch?: params["q"] == nil or params["q"] == ""
)
@@ -81,6 +83,8 @@ defmodule Mse25Web.PageController do
render(conn, :events,
page_title: title,
+ breadcrumbs: [],
+ show_interactive_event_map?: true,
contents: Earmark.as_html!(contents),
events: events,
q: params["q"],
@@ -93,6 +97,7 @@ defmodule Mse25Web.PageController do
render(conn, :links,
page_title: "Delningar",
+ breadcrumbs: [],
links: links
)
end
diff --git a/lib/mse25_web/controllers/page_html/articles.html.heex b/lib/mse25_web/controllers/page_html/articles.html.heex
index 2a8dd75..e91cf6d 100644
--- a/lib/mse25_web/controllers/page_html/articles.html.heex
+++ b/lib/mse25_web/controllers/page_html/articles.html.heex
@@ -1,49 +1,41 @@
-
-
-
-
- madr.se
-
-
-
-
- Webblogg
-
- Inlägg skrivna sedan 2006.
- <%= if @nosearch? do %>
- Gå direkt till:
- <% end %>
-
-
- <%= for {year, articles} <- @articles do %>
-
- year}><%= year %> (<%= Enum.count(articles) %>)
-
- <% end %>
-
-
- <%= for {year, articles} <- @articles do %>
- year}>
- <%= year %>
-
- <%= for article <- articles do %>
-
-
- <%= article["pubDate"] %>
-
- <% end %>
-
-
+
+ <%= @page_title %>
+
+
+ Inlägg skrivna sedan 2006.
+ <%= if @nosearch? do %>
+ Gå direkt till:
<% end %>
-
+
+
+ <%= for {year, articles} <- @articles do %>
+
+ year}><%= year %> (<%= Enum.count(articles) %>)
+
+ <% end %>
+
+
+<%= for {year, articles} <- @articles do %>
+ year}>
+ <%= year %>
+
+ <%= for article <- articles do %>
+
+
+ <%= article["pubDate"] %>
+
+ <% end %>
+
+
+<% end %>
diff --git a/lib/mse25_web/controllers/page_html/events.html.heex b/lib/mse25_web/controllers/page_html/events.html.heex
index aebd328..9c6f710 100644
--- a/lib/mse25_web/controllers/page_html/events.html.heex
+++ b/lib/mse25_web/controllers/page_html/events.html.heex
@@ -1,14 +1,5 @@
-
+<%= @page_title %>
+
<%= raw(@contents) %>
Geografisk utspridning
@@ -43,14 +34,14 @@
<%= year %>
<%= for event <- events do %>
-
+
- <%= event["lead"] %>
+ <%= event["lead"] %>
<%= if hilights?(event) do %>
- Personliga höjdpunkter: <%= bandlist(event["bands"]) %>
+ Personliga höjdpunkter: <%= rdfa_bandlist(event["bands"]) |> raw %>
<% end %>
<%= if missed?(event) do %>
@@ -60,13 +51,14 @@
<% end %>
<%= if opening_acts?(event) do %>
- Förband: <%= event["bands"] |> Enum.drop(1) |> bandlist() %>
+ Förband: <%= event["bands"] |> Enum.drop(1) |> rdfa_bandlist() |> raw %>
<% end %>
<%= if event["poster"] do %>
event["poster"]}
+ src={"https://n.madr.se/assets/" <> event["poster"] <> "?key=poster"}
alt="affisch"
width="150"
/>
@@ -76,5 +68,3 @@
<% end %>
-
diff --git a/lib/mse25_web/controllers/page_html/home.html.heex b/lib/mse25_web/controllers/page_html/home.html.heex
index 966a6b3..d02e289 100644
--- a/lib/mse25_web/controllers/page_html/home.html.heex
+++ b/lib/mse25_web/controllers/page_html/home.html.heex
@@ -1,72 +1,72 @@
-
+
-
-
-
+
<%= for event <- @upcoming do %>
-
+
<% end %>
<%= for event <- @recent_event do %>
-
+
<% end %>
-
-
-
+
<%= for legend <- @brutal_legends do %>
-
+
<% end %>
-
-
-
+
+
-
+
diff --git a/lib/mse25_web/controllers/page_html/links.html.heex b/lib/mse25_web/controllers/page_html/links.html.heex
index 4e000a9..98310e3 100644
--- a/lib/mse25_web/controllers/page_html/links.html.heex
+++ b/lib/mse25_web/controllers/page_html/links.html.heex
@@ -1,73 +1,65 @@
-