Merge pull request 'Delete useless feed files (rss1 & atom), for compatibility reasons, keep rss2' (#19) from delete-useless-feeds into main
Reviewed-on: #19
This commit is contained in:
commit
0153d20b89
1 changed files with 1 additions and 55 deletions
56
bin/blog.ml
56
bin/blog.ml
|
@ -311,7 +311,6 @@ module Article = struct
|
||||||
|
|
||||||
let title p = p#title
|
let title p = p#title
|
||||||
let description p = p#description
|
let description p = p#description
|
||||||
let tags p = p#tags
|
|
||||||
let date p = p#date
|
let date p = p#date
|
||||||
|
|
||||||
let neutral =
|
let neutral =
|
||||||
|
@ -503,9 +502,7 @@ struct
|
||||||
let target_root = S.target
|
let target_root = S.target
|
||||||
let pages = target_root
|
let pages = target_root
|
||||||
let articles = Path.(target_root / "articles")
|
let articles = Path.(target_root / "articles")
|
||||||
let rss1 = Path.(target_root / "rss1.xml")
|
|
||||||
let rss2 = Path.(target_root / "feed.xml")
|
let rss2 = Path.(target_root / "feed.xml")
|
||||||
let atom = Path.(target_root / "atom.xml")
|
|
||||||
|
|
||||||
let as_html into file =
|
let as_html into file =
|
||||||
file |> Path.move ~into |> Path.change_extension "html"
|
file |> Path.move ~into |> Path.change_extension "html"
|
||||||
|
@ -615,25 +612,6 @@ struct
|
||||||
~compute_link:(Target.as_html @@ Path.abs [ "articles" ])
|
~compute_link:(Target.as_html @@ Path.abs [ "articles" ])
|
||||||
Source.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 rss2 =
|
||||||
let open Task in
|
let open Task in
|
||||||
let from_articles ~title ~site_url ~description ~feed_url () =
|
let from_articles ~title ~site_url ~description ~feed_url () =
|
||||||
|
@ -683,44 +661,12 @@ struct
|
||||||
~feed_url:"https://blog.robur.coop/feed.xml" ()
|
~feed_url:"https://blog.robur.coop/feed.xml" ()
|
||||||
end
|
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 process_all ~host =
|
||||||
let open Eff in
|
let open Eff in
|
||||||
Action.restore_cache ~on:`Source Source.cache
|
Action.restore_cache ~on:`Source Source.cache
|
||||||
>>= process_css_files >>= process_js_files >>= process_images_files
|
>>= process_css_files >>= process_js_files >>= process_images_files
|
||||||
>>= process_tags ~host
|
>>= 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
|
>>= Action.store_cache ~on:`Source Source.cache
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue