Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: have at least one item in every RSS feed even if older than cuto… #2890

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tool/ood-gen/lib/news.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module RssFeed = struct
let create_feed () =
let open Rss in
all ()
|> create_entries ~create_entry ~days:9000 (* FIXME *)
|> create_entries ~create_entry ~days:90
|> entries_to_feed ~id:"news.xml" ~title:"OCaml News @ OCaml.org"
|> feed_to_string
end
8 changes: 6 additions & 2 deletions tool/ood-gen/lib/rss.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ let create_entries ~create_entry ?days u =
in
Option.fold ~none:Option.some ~some days
in
let entries = u |> List.filter_map (fun x -> x |> create_entry |> is_fresh) in
entries
let entries =
List.tl u |> List.map create_entry |> List.sort Syndic.Atom.descending
in
match List.filter_map is_fresh entries with
| [] -> [ List.hd entries ]
| xs -> xs

let entries_to_feed ~id ~title (entries : Syndic.Atom.entry list) =
let id = Uri.of_string ("https://ocaml.org/" ^ id) in
Expand Down
Loading