Skip to content

Commit

Permalink
improve events page title, cutoff date 90 days for events rss feed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sabine authored Aug 2, 2024
1 parent c73bb3b commit 444aba3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/ocamlorg_frontend/pages/events.eml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let render ~recurring_events ~upcoming_events =
Community_layout.single_column_layout
~title:"The Events"
~description:"The Events page!"
~title:"Upcoming OCaml Events"
~description:"Discover OCaml Events all around the world!"
~canonical:Url.events
~current:Events @@
<div class="w-full section-blue-gradient dark:bg-none">
Expand Down
15 changes: 11 additions & 4 deletions tool/ood-gen/lib/planet.ml
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,16 @@ module GlobalFeed = struct
(Syndic.Date.month start |> Syndic.Date.string_of_month)
(Syndic.Date.year start)
in
let cutoff =
Ptime.add_span start (Ptime.Span.v (90, 0L))
|> Option.get |> Ptime.to_rfc3339
in
let start = start |> Ptime.to_rfc3339 in
let events =
Event.all ()
|> List.filter (fun (e : Data_intf.Event.t) ->
String.compare e.starts.yyyy_mm_dd start > 0)
String.compare e.starts.yyyy_mm_dd start > 0
&& String.compare e.starts.yyyy_mm_dd cutoff < 0)
in
let authors = (Syndic.Atom.author "OCaml Events", []) in
let render_single_event (event : Data_intf.Event.t) =
Expand All @@ -303,7 +308,8 @@ module GlobalFeed = struct
(Syndic.Date.year start_date)
in
let content =
Format.sprintf {|<li><a href="%s">%s // %s // %s</a></li>|} event.url
Format.sprintf {|<li><a href="%s">%s // %s // %s</a></li>
|} event.url
event.title textual_location human_readable_date
in
content
Expand All @@ -313,15 +319,16 @@ module GlobalFeed = struct
events
|> List.map render_single_event
|> String.concat "\n"
|> Format.sprintf {|<p>Upcoming OCaml events:</p> <ul>%s</ul>|}
|> Format.sprintf {|<ul>%s</ul>|}
in

let period_start = Syndic.Date.of_rfc3339 start in

let id = Uri.of_string "https://ocaml.org/events" in
Syndic.Atom.entry ~id ~authors
~title:
(Syndic.Atom.Text ("Upcoming OCaml Events: " ^ human_readable_date))
(Syndic.Atom.Text
("Upcoming OCaml Events (" ^ human_readable_date ^ " and onwards)"))
~updated:period_start
~links:[ Syndic.Atom.link (Uri.of_string "https://ocaml.org/events") ]
~categories:[ Syndic.Atom.category "events" ]
Expand Down

0 comments on commit 444aba3

Please sign in to comment.