From 64a9830f6d4ea03fb032b13e70678cead9e10e47 Mon Sep 17 00:00:00 2001 From: Carmen La Date: Wed, 8 Jul 2015 16:55:31 -0400 Subject: [PATCH] Only make the "prev" link in the second page when the second page actually exists --- src/cryogen_core/compiler.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cryogen_core/compiler.clj b/src/cryogen_core/compiler.clj index 1a45070..3c809d1 100644 --- a/src/cryogen_core/compiler.clj +++ b/src/cryogen_core/compiler.clj @@ -272,8 +272,8 @@ [{:keys [blog-prefix posts-per-page blocks-per-preview] :as params} posts] (when-not (empty? posts) (let [previews (-> (create-previews posts-per-page blocks-per-preview posts) - (create-preview-links blog-prefix) - (assoc-in [1 :prev] (str blog-prefix "/index.html")))] + (create-preview-links blog-prefix)) + previews (if (> (count previews) 1) (assoc-in previews [1 :prev] (str blog-prefix "/index.html")) previews)] (create-folder (str blog-prefix "/p/")) (doseq [{:keys [index posts prev next]} previews] (spit (if (= 1 index) (str public blog-prefix "/index.html") (str public blog-prefix "/p/" index))