mob-seassion

This commit is contained in:
lukas 2019-12-27 11:00:41 +01:00
parent f74c21e586
commit e3bc96ce4e

View file

@ -239,7 +239,7 @@
[{:keys [blog-prefix page-root-uri debug?] :as params} pages] [{:keys [blog-prefix page-root-uri debug?] :as params} pages]
(when-not (empty? pages) (when-not (empty? pages)
(println (blue "compiling pages")) (println (blue "compiling pages"))
(cryogen-io/create-folder (cryogen-io/path "/" blog-prefix page-root-uri)) ;(cryogen-io/create-folder (cryogen-io/path "/" blog-prefix page-root-uri))
(doseq [{:keys [uri] :as page} pages] (doseq [{:keys [uri] :as page} pages]
(println "-->" (cyan uri)) (println "-->" (cyan uri))
(when debug? (when debug?
@ -494,21 +494,30 @@
author-root-uri theme debug? page-model author-root-uri theme debug? page-model
page-root-uri resources] page-root-uri resources]
:as config} (read-config) :as config} (read-config)
posts (map klipsify (add-prev-next (read-posts config))) posts
posts-by-tag (group-by-tags posts) (map klipsify (add-prev-next (read-posts config)))
posts (tag-posts posts config) posts-by-tag
latest-posts (->> posts (take recent-posts) vec) (group-by-tags posts)
klipsified-pages (map klipsify (read-pages config)) posts
modelled-pages (cond (tag-posts posts config)
latest-posts
(->> posts (take recent-posts) vec)
klipsified-pages
(map klipsify (read-pages config))
modelled-pages
(cond
(= page-model :flat) klipsified-pages (= page-model :flat) klipsified-pages
(= page-model :hierarchic) (hierarchic/build-hierarchic-map page-root-uri klipsified-pages)) (= page-model :hierarchic) (hierarchic/build-hierarchic-map page-root-uri klipsified-pages))
home-page (->> modelled-pages home-page
(->> modelled-pages
(filter #(boolean (:home? %))) (filter #(boolean (:home? %)))
(first)) (first))
other-pages (->> modelled-pages other-pages
(->> modelled-pages
(remove #{home-page}) (remove #{home-page})
(add-prev-next)) (add-prev-next))
params (merge config params
(merge config
{:today (java.util.Date.) {:today (java.util.Date.)
:title (:site-title config) :title (:site-title config)
:active-page "home" :active-page "home"
@ -523,15 +532,18 @@
:tags-uri (page-uri "tags.html" config) :tags-uri (page-uri "tags.html" config)
:rss-uri (cryogen-io/path "/" blog-prefix rss-name) :rss-uri (cryogen-io/path "/" blog-prefix rss-name)
:site-url (if (.endsWith site-url "/") (.substring site-url 0 (dec (count site-url))) site-url)}) :site-url (if (.endsWith site-url "/") (.substring site-url 0 (dec (count site-url))) site-url)})
file-resource-path (str "file:resources/templates/themes/" theme) file-resource-path
classpath-resource-path (str "templates/themes/" theme)] (str "file:resources/templates/themes/" theme)
classpath-resource-path
(str "templates/themes/" theme)]
(when debug? (when debug?
(println (blue "debug: page-model:")) (println (blue "debug: page-model:"))
(println "\t-->" (cyan page-model)) (println "\t-->" (cyan page-model))
(println (blue "debug: home-page:")) (println (blue "debug: home-page:"))
(println "\t-->" (cyan (-> params :home-page)))) (println "\t-->" (cyan (-> params :home-page))))
;; TODO: replace by file-resource-path or classpath-resource-path ;; TODO: replace by file-resource-path or classpath-resource-path
(set-custom-resource-path! (str "file:resources/templates/themes/" theme)) (println file-resource-path)
(set-custom-resource-path! file-resource-path)
;(cryogen-io/wipe-public-folder keep-files) ;(cryogen-io/wipe-public-folder keep-files)
(cp-io/delete-resource-recursive! (cp-io/path "resources/public" blog-prefix)) (cp-io/delete-resource-recursive! (cp-io/path "resources/public" blog-prefix))
(println (blue "copying theme resources")) (println (blue "copying theme resources"))