fixed error if no tag supplied, customize title of page with article's name - cl-yag - Common Lisp Yet Another website Generator HTML git clone git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/cl-yag/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 7682a4620e7aa93fabcd996fe7450e8f67bf7f37 DIR parent 94f67f290121a55da02ca3440e4ec4899622bc78 HTML Author: solene rapenne <solene@dataswamp.org> Date: Thu, 19 May 2016 11:07:31 +0200 fixed error if no tag supplied, customize title of page with article's name Diffstat: M generator.lisp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- DIR diff --git a/generator.lisp b/generator.lisp @@ -81,7 +81,7 @@ (strip-quotes (mapcar #'(lambda (item) (prepare "template/one-tag.tpl" (template "%%Name%%" item))) - (split-str (getf article :tag ""))))) + (split-str (getf article :tag))))) ;; generates the html of the whole list of tags (defun get-tag-list() @@ -107,9 +107,9 @@ ;; return a html string ;; produce the code of a whole page with title+layout with the parameter as the content -(defun generate-layout(body) +(defun generate-layout(body &optional &key (title nil)) (prepare "template/layout.tpl" - (template "%%Title%%" (getf *config* :title)) + (template "%%Title%%" (if title title (getf *config* :title))) (template "%%Tags%%" (get-tag-list)) (template "%%Body%%" body) output)) @@ -159,7 +159,8 @@ ;; produce each article file (dolist (article *articles*) (generate (format nil "article-~d.html" (getf article :id)) - (create-article article :tiny nil))) + (create-article article :tiny nil) + :title (concatenate 'string (getf *config* :title) " : " (getf article :title)))) ;; produce index file for each tag (loop for tag in (articles-by-tag) do