diff options
Diffstat (limited to 'jakob')
| -rw-r--r-- | jakob/builder/blog.scm | 12 | ||||
| -rw-r--r-- | jakob/builder/index.scm | 82 | ||||
| -rw-r--r-- | jakob/theme.scm | 6 |
3 files changed, 95 insertions, 5 deletions
diff --git a/jakob/builder/blog.scm b/jakob/builder/blog.scm index c14cecf..b3f83a6 100644 --- a/jakob/builder/blog.scm +++ b/jakob/builder/blog.scm @@ -33,6 +33,8 @@ #:use-module (srfi srfi-26) #:use-module (web uri) #:export (post-uri + render-preview + sort-posts blog)) ;;; Commentary: @@ -165,6 +167,12 @@ ;; Subdirectory for post listings conditioned on post tags. (define %tag-prefix (string-append %blog-prefix "/tag")) +(define* (sort-posts posts #:keywords (reverse? #f)) + (sort posts (lambda (a b) + ((if reverse? time>=? time<?) + (date->time-monotonic (post-date a)) + (date->time-monotonic (post-date b)))))) + (define (tags->pages posts) "Return a list of pages for each tag used in POSTS, with said pages containing only the posts tagged with that tag." @@ -173,8 +181,8 @@ only the posts tagged with that tag." (items->pages render-preview posts (format #f "Posts tagged with \"~a\"" tag) (tag-uri %tag-prefix tag "")))) - (group-by-tag (sort posts (lambda (a b) - (time<? (date->time-monotonic (post-date a)) (date->time-monotonic (post-date b))))) (cut post-ref <> 'tags)))) + (group-by-tag (sort-posts posts #:reverse? #t) + (cut post-ref <> 'tags)))) (define (all-tags posts) "Return a page summarizing tag usage across POSTS." diff --git a/jakob/builder/index.scm b/jakob/builder/index.scm new file mode 100644 index 0000000..6706f35 --- /dev/null +++ b/jakob/builder/index.scm @@ -0,0 +1,82 @@ +;;; Copyright © 2019 - 2026 Jakob L. Kreuze <zerodaysfordays@sdf.org> +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 3 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see +;;; <http://www.gnu.org/licenses/>. + +(define-module (jakob builder index) + #:use-module (haunt artifact) + #:use-module (haunt html) + ;; #:use-module (haunt post) + ;; #:use-module (haunt utils) + ;; #:use-module (ice-9 format) + ;; #:use-module (ice-9 match) + #:use-module (jakob builder blog) + #:use-module (jakob theme) + #:use-module (jakob utils org-mode) + ;; #:use-module (jakob utils pagination) + ;; #:use-module (jakob utils sxml) + ;; #:use-module (jakob utils tags) + ;; #:use-module (jakob utils comments) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) + ;; #:use-module (srfi srfi-19) + ;; #:use-module (srfi srfi-26) + ;; #:use-module (web uri) + #:export (index) + ) + +(define about-me-section + `(section (@ (id "about-me")) + (h2 (@ (class "section-header")) "About Me") + ,@(let-values (((_ sxml) (read-org-mode-file "pages/about.org"))) + sxml))) + +(define about-site-section + `(section (@ (id "about-site")) + (h2 (@ (class "section-header")) "About This Website") + ,@(let-values (((_ sxml) (read-org-mode-file "pages/about-site.org"))) + sxml))) + +(define selected-works-section + `(section (@ (id "selected-works")) + (h2 (@ (class "section-header")) "Selected Works") + (p "Click a thumbnail to view project details.") + (div (@ (class "project-grid") (role "list")) + ,(map (lambda (i) + `(a (@ (class "project-thumb") (role "listitem") (href "#")) + ,(format #f "[ PROJECT ~a ]" i))) + (iota 6))))) + +(define (posts-section posts) + `((h2 (@ (class "section-header")) "Recent Articles") + ,@(map render-preview posts))) + +(define (index) + "Return a Haunt build procedure to create an index page." + (lambda (site posts) + `(,(serialized-artifact "index.html" + (theme ;; #:title (post-ref post 'title) + ;; #:description (description-from-post post) + ;; #:keywords (post-ref post 'tags) + ;; #:meta (if (not (eof-object? meta-tags)) meta-tags '()) + ;; #:scripts (if (not (eof-object? scripts)) scripts '()) + #:content `(,about-me-section + (hr (@ (aria-hidden "true"))) + ,(posts-section (take (sort-posts posts) 3)) + (hr (@ (aria-hidden "true"))) + ,selected-works-section + (hr (@ (aria-hidden "true"))) + ,about-site-section + )) + sxml->html)))) diff --git a/jakob/theme.scm b/jakob/theme.scm index 439b066..512df70 100644 --- a/jakob/theme.scm +++ b/jakob/theme.scm @@ -140,10 +140,10 @@ `(footer (@ (class "site-footer")) (img (@ (src "/static/image/cc-by-sa-4.0.png") (alt "Creative Commons BY-SA 4.0"))) - "©" + "© " (time (@ (datetime "2015")) "2015") " - " - (time (@ (datetime ,year)) ,year)/ + (time (@ (datetime ,year)) ,year) " Jakob L. Kreuze"))) (define* (theme #:key @@ -161,7 +161,7 @@ (head ,(if (null? title) - `(title %title) + `(title ,%title) `(title ,(string-join (list title %title) " :: "))) (meta (@ (charset "utf-8"))) |