Added curated RSS generation based on :rss-filters in the config

This commit is contained in:
lacarmen 2015-01-03 20:36:30 -05:00
parent 6c9be90fa4
commit 656cc2d0c9
3 changed files with 14 additions and 4 deletions

View file

@ -1,4 +1,4 @@
(defproject cryogen-core "0.1.11"
(defproject cryogen-core "0.1.12"
:description "Cryogen's compiler"
:url "https://github.com/lacarmen/cryogen-core"
:license {:name "Eclipse Public License"

View file

@ -257,6 +257,7 @@
read-string
(update-in [:blog-prefix] (fnil str ""))
(update-in [:rss-name] (fnil str "rss.xml"))
(update-in [:rss-filters] (fnil seq []))
(update-in [:sass-src] (fnil str "css"))
(update-in [:sass-dest] (fnil str "css"))
(update-in [:post-date-format] (fnil str "yyyy-MM-dd"))
@ -299,8 +300,10 @@
(compile-archives default-params posts config)
(println (blue "generating site map"))
(spit (str public blog-prefix "/sitemap.xml") (sitemap/generate site-url ignored-files))
(println (blue "generating rss"))
(println (blue "generating main rss"))
(spit (str public blog-prefix "/" rss-name) (rss/make-channel config posts))
(println (blue "generating filtered rss"))
(rss/make-filtered-channels public config posts-by-tag)
(println (blue "compiling sass"))
(sass/compile-sass->css!
(str "resources/templates/" sass-src)

View file

@ -1,6 +1,7 @@
(ns cryogen-core.rss
(:require [clj-rss.core :as rss]
[clojure.xml :refer [emit]])
[clojure.xml :refer [emit]]
[text-decoration.core :refer :all])
(:import java.util.Date))
@ -25,4 +26,10 @@
:description (:description config)
:lastBuildDate (Date.)
:author (:author config)})
(posts-to-items (:site-url config) (:author config) posts)))
(posts-to-items (:site-url config) (:author config) posts)))
(defn make-filtered-channels [public {:keys [rss-filters blog-prefix] :as config} posts-by-tag]
(doseq [filter rss-filters]
(let [uri (str public blog-prefix "/" (name filter) ".xml")]
(println "\t-->" (cyan uri))
(spit uri (make-channel config (get posts-by-tag filter))))))