Make archive grouping configurable

The blog that I'm moving to cryogen currently groups the posts by year instead of by year/month. This change makes the grouping configurable while defaulting to the current behavior of year/month grouping on posts.
This commit is contained in:
Dan Hable 2016-03-08 20:22:20 -06:00
parent 36656de029
commit 683bcad292

View file

@ -105,7 +105,7 @@
(let [date (if (:date page-meta) (let [date (if (:date page-meta)
(.parse (java.text.SimpleDateFormat. (:post-date-format config)) (:date page-meta)) (.parse (java.text.SimpleDateFormat. (:post-date-format config)) (:date page-meta))
(parse-post-date file-name (:post-date-format config))) (parse-post-date file-name (:post-date-format config)))
archive-fmt (java.text.SimpleDateFormat. "yyyy MMMM" (Locale/getDefault)) archive-fmt (java.text.SimpleDateFormat. (get config :archive-group-format "yyyy MMMM") (Locale/getDefault))
formatted-group (.format archive-fmt date)] formatted-group (.format archive-fmt date)]
{:date date {:date date
:formatted-archive-group formatted-group :formatted-archive-group formatted-group