iadding a way to choose the number of rss items - cl-yag - Common Lisp Yet Another website Generator Err bitreich.org 70 hgit clone git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/cl-yag/ URL:git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/cl-yag/ bitreich.org 70 1Log /scm/cl-yag/log.gph bitreich.org 70 1Files /scm/cl-yag/files.gph bitreich.org 70 1Refs /scm/cl-yag/refs.gph bitreich.org 70 1Tags /scm/cl-yag/tag bitreich.org 70 1README /scm/cl-yag/file/README.md.gph bitreich.org 70 1LICENSE /scm/cl-yag/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit 76baf068a53ee155aa4850c0beac0ecfeb51b59d /scm/cl-yag/commit/76baf068a53ee155aa4850c0beac0ecfeb51b59d.gph bitreich.org 70 1parent 5224dea43a91267d621f6ed78fcea25ed5c67243 /scm/cl-yag/commit/5224dea43a91267d621f6ed78fcea25ed5c67243.gph bitreich.org 70 hAuthor: solene rapenne URL:mailto:solene@dataswamp.org bitreich.org 70 iDate: Wed, 8 Jun 2016 12:25:02 +0200 Err bitreich.org 70 i Err bitreich.org 70 iadding a way to choose the number of rss items Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M README.md | 10 ++++++++++ Err bitreich.org 70 i M data/articles.lisp | 1 + Err bitreich.org 70 i M generator.lisp | 4 +++- Err bitreich.org 70 i Err bitreich.org 70 i3 files changed, 14 insertions(+), 1 deletion(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/README.md b/README.md /scm/cl-yag/file/README.md.gph bitreich.org 70 i@@ -23,6 +23,16 @@ Here are the files and folder of cl-yag : Err bitreich.org 70 i Err bitreich.org 70 i # Usage Err bitreich.org 70 i Err bitreich.org 70 i+## Configuration Err bitreich.org 70 i+ Err bitreich.org 70 i+In data/articles.lisp there is a ***config*** variable with the following fields : Err bitreich.org 70 i+ Err bitreich.org 70 i++ **:webmaster** : The name of the default author, this is the name used when **:author** is omitted Err bitreich.org 70 i++ **:title** : The title of the webpage Err bitreich.org 70 i++ **:description** : This text is used in the *description* field of the Atom RSS Err bitreich.org 70 i++ **:url** : This is the full url of the blog with the final slash. If the url contains a ~ it should be doubled (e.g. : https://mydomain/~~user/ is a valid url) Err bitreich.org 70 i++ **:rss-item-number** : This is the number of RSS items you want to published when you generate the files, it will publish the last N articles Err bitreich.org 70 i+ Err bitreich.org 70 i ## How to add an article Err bitreich.org 70 i Err bitreich.org 70 i Edit data/articles.lisp and add a new line inside the *articles* variable like this (you can do it in one line, as you prefer) Err bitreich.org 70 1diff --git a/data/articles.lisp b/data/articles.lisp /scm/cl-yag/file/data/articles.lisp.gph bitreich.org 70 i@@ -10,6 +10,7 @@ Err bitreich.org 70 i :title "Your blog title here" Err bitreich.org 70 i :description "Yet another website on the net" Err bitreich.org 70 i :url "https://my.website/~~user/" ;; the trailing slash is mandatory, rss links will fails without it Err bitreich.org 70 i+ :rss-item-number 10 ;; we want 10 items in our RSS feed Err bitreich.org 70 i )) Err bitreich.org 70 i Err bitreich.org 70 i ;; describes articles (ordered on the website as they are displayed here, the first in list is the top of the website) Err bitreich.org 70 1diff --git a/generator.lisp b/generator.lisp /scm/cl-yag/file/generator.lisp.gph bitreich.org 70 i@@ -131,7 +131,9 @@ Err bitreich.org 70 i ;; xml generation of the items for the rss Err bitreich.org 70 i (defun generate-rss-item() Err bitreich.org 70 i (strip-quotes Err bitreich.org 70 i- (loop for article in *articles* collect Err bitreich.org 70 i+ (loop for article in *articles* Err bitreich.org 70 i+ for i from 1 to (if (> (length *articles*) (getf *config* :rss-item-number)) (getf *config* :rss-item-number) (length *articles*)) Err bitreich.org 70 i+ collect Err bitreich.org 70 i (prepare "template/rss-item.tpl" Err bitreich.org 70 i (template "%%Title%%" (getf article :title)) Err bitreich.org 70 i (template "%%Description%%" (load-file (format nil "data/~d.txt" (getf article :id)))) Err bitreich.org 70 .