commit 994f2224eb625f71b68cb00a77edc37068f0f059 Solene Rapenne <solene@perso.pw> 2017-01-21 16:53:27 +0100 Index of articles page
generator.lisp | 20 ++++++++++++-------- template/layout.tpl | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/generator.lisp b/generator.lisp index 9e1c1ee..ee0bb77 100644 --- a/generator.lisp +++ b/generator.lisp @@ -94,16 +94,18 @@ ;; generates the html of one only article ;; this is called in a loop to produce the homepage -(defun create-article(article &optional &key (tiny t)) +(defun create-article(article &optional &key (tiny t) (no-text nil)) (prepare "template/article.tpl" (template "%%Author%%" (getf article :author (getf *config* :webmaster))) (template "%%Date%%" (getf article :date)) (template "%%Title%%" (getf article :title)) (template "%%Id%%" (getf article :id)) (template "%%Tags%%" (get-tag-list-article article)) - (template "%%Text%%" (if (and tiny (member :tiny article)) - (getf article :tiny) - (load-file (format nil "temp/data/~d.html" (getf article :id))))))) + (template "%%Text%%" (if no-text + "" + (if (and tiny (member :tiny article)) + (getf article :tiny) + (load-file (format nil "temp/data/~d.html" (getf article :id)))))))) ;; return a html string ;; produce the code of a whole page with title+layout with the parameter as the content @@ -116,10 +118,10 @@ ;; html generation of index homepage -(defun generate-semi-mainpage() +(defun generate-semi-mainpage(&key (tiny t) (no-text nil)) (strip-quotes (loop for article in *articles* collect - (create-article article :tiny t)))) + (create-article article :tiny tiny :no-text no-text)))) ;; html generation of a tag homepage (defun generate-tag-mainpage(articles-in-tag) @@ -150,12 +152,14 @@ (template "%%Url%%" (getf *config* :url)) (template "%%Items%%" (generate-rss-item)))) - ;; We do all the website (defun create-html-site() ;; produce index.html (generate "output/html/index.html" (generate-semi-mainpage)) - + + ;; produce index-titles.html where there are only articles titles + (generate "output/html/index-titles.html" (generate-semi-mainpage :no-text t)) + ;; produce each article file (dolist (article *articles*) (generate (format nil "output/html/article-~d.html" (getf article :id)) diff --git a/template/layout.tpl b/template/layout.tpl index 275df13..0080d9b 100644 --- a/template/layout.tpl +++ b/template/layout.tpl @@ -8,7 +8,7 @@ <body> <div id="top"> - <a href="index.html">Home</a> <a href="rss.xml">Rss</a> + <a href="index.html">Home</a> - <a href="index-titles.html">List of articles</a> - <a href="rss.xml">Rss</a> <p>Tags : %%Tags%%</p> </div>