summaryrefslogtreecommitdiffstats
path: root/apps/blog/templates/post-list.scm
blob: c63b01af39b49c5528c51ba0f5b7933f20f310e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
;;; Harmonic Flow web site

(define-module (apps blog templates post-list)
  #:use-module (apps aux web)
  #:use-module (apps base templates components)
  #:use-module (apps base templates theme)
  #:use-module (apps base types)
  #:use-module (apps base utils)
  #:use-module ((apps blog templates components) #:prefix blog:)
  #:use-module (apps i18n)
  #:export (post-list-t))


(define (post-list-t context)
  "Return a list of blog posts in SHTML with the data in CONTEXT."
  (let ((page-number
	 (number->string (context-datum context "page-number")))
	(total-pages
	 (number->string (context-datum context "total-pages"))))
    (theme
     #:title (list (G_ (string-append "Page " page-number ""))
                   (C_ "webpage title" "Blog |"))
     #:description
     (G_ "Blog posts about programming and free software.")
     #:keywords
     (string-split ;TRANSLATORS: |-separated list of webpage keywords
      (G_ "Harmonic Flow Blog|HFGE|Free Software|C++|Libre software|Graphics Programming|Vulkan") #\|)
     #:index? #false
     #:active-menu-item (C_ "website menu" "Blog")
     #:css
     (list (hfweb-url "static/base/css/page.css")
	   (hfweb-url "static/base/css/item-preview.css")
	   (hfweb-url "static/base/css/sidebar.css"))
     #:crumbs
     (list (crumb (C_ "website menu" "Blog") (hfweb-url "blog/"))
           (crumb (G_ (string-append "Page " page-number ""))
		  (hfweb-url (url-path-join "blog"
					   "page"
					   page-number
					   ""))))
     #:content
     `(main
       (section
	(@ (class "page centered-text"))
        (h2 (G_ "Blog")
	    ,(page-indicator (string->number page-number)
			     (string->number total-pages)))

	(div
	 (@ (class "sheet"))
	 ,@(map blog:post-preview (context-datum context "items"))
	 ,(page-selector (string->number total-pages)
			 (string->number page-number)
			 (hfweb-url "blog")))

	,(blog:sidebar (context-datum context "tags")))))))