From da853a0efcc351a3a609ce2653a24c56201263fd Mon Sep 17 00:00:00 2001 From: Lucian Mogosanu Date: Tue, 26 Feb 2019 20:51:45 +0200 Subject: [PATCH] blog: Update tag list only for published posts --- blog.lisp | 5 +++-- templates/post.lisp | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/blog.lisp b/blog.lisp index cd64966..e0e3e5b 100644 --- a/blog.lisp +++ b/blog.lisp @@ -109,8 +109,9 @@ (blist (tlbs-make-blist relative-pathname)) (in-path (gethash "in-path" blist)) (out-path (gethash "out-path" blist))) - ;; process tags - (when (not draft) (tlbs-make-tagids blist)) + ;; process tags; update tag list with post when we're publishing + ;; the post. + (tlbs-make-tagids blist :update-tlist (not draft)) (when (file-modified in-path out-path) (format t "[proc] ~s~%" x) ;; markdown -> html diff --git a/templates/post.lisp b/templates/post.lisp index 9252a97..76ef5dc 100644 --- a/templates/post.lisp +++ b/templates/post.lisp @@ -78,14 +78,15 @@ ; add new tlist (push tlist *tags*))))) -(defun tlbs-make-tagids (blist) +(defun tlbs-make-tagids (blist &key (update-tlist t)) (let ((new-tags (cl-ppcre:split "\\s*,\\s*" (gethash "tags" blist)))) ; set tagid list in blist (setf (gethash "tags" blist) new-tags) ; as a side effect, adjoin a potential new tlist to the tag list - (dolist (tagid new-tags) - (adjoin-tagid tagid blist))) + (when update-tlist + (dolist (tagid new-tags) + (adjoin-tagid tagid blist)))) blist) (defun pipe-through-pandoc (blist) -- 1.7.10.4