From caec8c419cde6f813b59109ba3742d1a0a7eb13d Mon Sep 17 00:00:00 2001 From: Calascibetta Romain Date: Fri, 25 Oct 2024 17:44:44 +0200 Subject: [PATCH] Delete useless feed files (rss1 & atom), for compatibility reasons, keep rss2 --- bin/blog.ml | 56 +---------------------------------------------------- 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/bin/blog.ml b/bin/blog.ml index 1d541e1..a22b003 100644 --- a/bin/blog.ml +++ b/bin/blog.ml @@ -311,7 +311,6 @@ module Article = struct let title p = p#title let description p = p#description - let tags p = p#tags let date p = p#date let neutral = @@ -503,9 +502,7 @@ struct let target_root = S.target let pages = target_root let articles = Path.(target_root / "articles") - let rss1 = Path.(target_root / "rss1.xml") let rss2 = Path.(target_root / "feed.xml") - let atom = Path.(target_root / "atom.xml") let as_html into file = file |> Path.move ~into |> Path.change_extension "html" @@ -615,25 +612,6 @@ struct ~compute_link:(Target.as_html @@ Path.abs [ "articles" ]) Source.articles - let rss1 = - let from_articles ~title ~site_url ~description ~feed_url () = - let open Yocaml_syndication in - Rss1.from ~title ~url:feed_url ~link:site_url ~description - @@ fun (path, article) -> - let title = Article.title article in - let link = site_url ^ Yocaml.Path.to_string path in - let description = Article.description article in - Rss1.item ~title ~link ~description - in - let open Task in - Action.write_static_file Target.rss1 - begin - fetch_articles - >>> from_articles ~title:feed_title ~site_url - ~description:feed_description - ~feed_url:"https://blog.robur.coop/rss1.xml" () - end - let rss2 = let open Task in let from_articles ~title ~site_url ~description ~feed_url () = @@ -683,44 +661,12 @@ struct ~feed_url:"https://blog.robur.coop/feed.xml" () end - let atom = - let open Task in - let open Yocaml_syndication in - let authors = Yocaml.Nel.singleton @@ Person.make "The Robur Team" in - let from_articles ?(updated = Atom.updated_from_entries ()) ?(links = []) - ?id ~site_url ~authors ~title ~feed_url () = - let id = Option.value ~default:feed_url id in - let feed_url = Atom.self feed_url in - let base_url = Atom.link site_url in - let links = base_url :: feed_url :: links in - Atom.from ~links ~updated ~title ~authors ~id - begin - fun (path, article) -> - let title = Article.title article in - let content_url = site_url ^ Yocaml.Path.to_string path in - let updated = - Datetime.make (Date.to_archetype_date_time (Article.date article)) - in - let categories = List.map Category.make (Article.tags article) in - let summary = Atom.text (Article.description article) in - let links = [ Atom.alternate content_url ~title ] in - Atom.entry ~links ~categories ~summary ~updated ~id:content_url - ~title:(Atom.text title) () - end - in - Action.write_static_file Target.atom - begin - fetch_articles - >>> from_articles ~site_url ~authors ~title:(Atom.text feed_title) - ~feed_url:"https://blog.robur.coop/atom.xml" () - end - let process_all ~host = let open Eff in Action.restore_cache ~on:`Source Source.cache >>= process_css_files >>= process_js_files >>= process_images_files >>= process_tags ~host - >>= process_articles ~host >>= process_index ~host >>= rss1 >>= rss2 >>= atom + >>= process_articles ~host >>= process_index ~host >>= rss2 >>= Action.store_cache ~on:`Source Source.cache end