Index of articles page - 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 994f2224eb625f71b68cb00a77edc37068f0f059
DIR parent 93abe73f502660ada5aeb21bd6eaffec14f8fef3
HTML Author: Solene Rapenne <solene@perso.pw>
Date: Sat, 21 Jan 2017 16:53:27 +0100
Index of articles page
Diffstat:
M generator.lisp | 20 ++++++++++++--------
M template/layout.tpl | 2 +-
2 files changed, 13 insertions(+), 9 deletions(-)
---
DIR diff --git 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))
DIR diff --git 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>