25/lib/mse25/event_helpers.ex
Anders Englöf Ytterström 57e935ec00
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
2024-10-16 15:40:53 +02:00

40 lines
996 B
Elixir

defmodule Mse25.EventHelpers do
def hilights?(%{"bands" => bands, "category" => category}) do
_festival_band?(bands, category)
end
def missed?(%{"mia" => bands, "category" => category}) do
_festival_band?(bands, category)
end
def opening_acts?(%{"bands" => [_ | bands], "category" => "concert"}) do
not Enum.empty?(bands)
end
def opening_acts?(_) do
false
end
def _festival_band?(bands, category)
when category in ["cruise", "openairfestival", "cityfestival", "onedayfestival"] do
not Enum.empty?(bands)
end
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 -> "<span property=\"performer\">#{b["artists_id"]["name"]}</span>" end)
|> Enum.join(", ")
|> String.replace(~r/, ([^,]+?)$/, " och \\1")
end
end