blog.scm
| 1 | ;;; Nani Project website |
| 2 | ;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu> |
| 3 | ;;; |
| 4 | ;;; This file is part of the Nani Project website. |
| 5 | ;;; |
| 6 | ;;; The Nani Project website is free software; you can redistribute it and/or modify it |
| 7 | ;;; under the terms of the GNU Affero General Public License as published by |
| 8 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 9 | ;;; your option) any later version. |
| 10 | ;;; |
| 11 | ;;; The Nani Project website is distributed in the hope that it will be useful, but |
| 12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | ;;; GNU Affero General Public License for more details. |
| 15 | ;;; |
| 16 | ;;; You should have received a copy of the GNU Affero General Public License |
| 17 | ;;; along with the Nani Project website. If not, see <http://www.gnu.org/licenses/>. |
| 18 | |
| 19 | (define-module (pages blog) |
| 20 | #:use-module (tools haunt-i18n) |
| 21 | #:use-module (tools i18n) |
| 22 | #:use-module (tools theme) |
| 23 | #:use-module (haunt builder blog) |
| 24 | #:use-module (haunt post) |
| 25 | #:export (blog-pages get-posts)) |
| 26 | |
| 27 | (define (get-posts posts) |
| 28 | "Returns POSTS sorted in reverse chronological order, excluding drafts." |
| 29 | (filter (lambda (post) |
| 30 | (not (member "draft" (post-ref post 'tags)))) |
| 31 | (posts/reverse-chronological posts))) |
| 32 | |
| 33 | (define (get-lang-posts lang) |
| 34 | (lambda (posts) |
| 35 | "Returns POSTS sorted in reverse chronological order, excluding drafts." |
| 36 | (filter (lambda (post) |
| 37 | (and (not (member "draft" (post-ref post 'tags))) |
| 38 | (member lang (post-ref post 'tags)))) |
| 39 | (posts/reverse-chronological posts)))) |
| 40 | |
| 41 | (define (get-every-posts posts) |
| 42 | (filter (lambda (post) |
| 43 | (not (member "draft" (post-ref post 'tags)))) |
| 44 | (posts/reverse-chronological posts))) |
| 45 | |
| 46 | (define get-posts-en (get-lang-posts "en")) |
| 47 | |
| 48 | (define nani-articles-en |
| 49 | `(("Articles" "blog.en.html" ,get-posts-en))) |
| 50 | |
| 51 | |
| 52 | (define %articles |
| 53 | `(("Articles" "blog.html" ,get-posts))) |
| 54 | |
| 55 | (define %complete-articles |
| 56 | `(("Articles" "blog-complete.html" ,get-posts))) |
| 57 | (define %complete-articles-en |
| 58 | `(("Articles" "blog-complete.en.html" ,get-posts))) |
| 59 | |
| 60 | (define blog-pages |
| 61 | (list |
| 62 | (blog #:theme (nani-theme "en" "blog") #:collections nani-articles-en) |
| 63 | (blog #:theme (nani-theme "en" "blog-complete") #:collections %complete-articles-en))) |
| 64 |