summaryrefslogtreecommitdiffstats
path: root/apps/blog/templates/post.scm
blob: 8a4880db9f118a23b0058e02a0245d67c076c93c (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
57
58
59
60
61
62
63
64
65
66
67
68
69
;;; Harmonic Flow web site

(define-module (apps blog templates post)
  #: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 utils)
  #:use-module ((apps blog templates components) #:prefix blog:)
  #:use-module (apps i18n)
  #:use-module (haunt post)
  #:use-module (srfi srfi-19)
  #:export (post-t))


(define (post-t context)
  "Return a page in SHTML for the post in the given CONTEXT."
  (let* ((post (context-datum context "post"))
	 (tags (post-ref post 'tags)))
    (theme
     #:title (list (post-ref post 'title)
                   (C_ "webpage title" "|"))
     #:description
     (G_ (string-append "Blog post about "
                        (post-ref post 'title)
                        " on Harmonic Flow Blog."))
     #:keywords tags
     #:active-menu-item (C_ "website menu" "Blog")
     #:css
     (list (hfweb-url "static/base/css/page.css")
	   (hfweb-url "static/blog/css/post.css"))
     #:crumbs
     (list (crumb (C_ "website menu" "Blog") (hfweb-url "blog/"))
	   (crumb (post-ref post 'title)
		  (hfweb-url (post-url-path post))))
     #:content
     `(main
       (article
        (@ (class "page centered-block limit-width") (lang "en"))
	(h2 ,(post-ref post 'title))
	(p
         (@ (class "post-metadata centered-text") (lang ,%current-ietf-tag))
	 ,(post-ref post 'author) " — "
         ,(date->string (post-date post) (C_ "SRFI-19 date->string format"
                                             "~B ~e, ~Y")))

	,(change-image-to-video
          (syntax-highlight (post-sxml post)))

	(div
         (@ (class "tag-list") (lang ,%current-ietf-tag))
         ,(G_ `(p "Related topics:"))

	 ,@(map
	    (lambda (tag)
	      (list
	       (button-little
		#:label tag
		#:url (hfweb-url (tag-url-path tag)))
	       " ")) ; NOTE: Force space for readability in non-CSS browsers.
	    (sort tags tag-first?)))

        (div
         (@ (class "license") (lang ,%current-ietf-tag))
         ,(G_ `(p "Unless otherwise stated, blog posts on this site are
                   copyrighted by their respective authors and published under the terms of the "
         ,(G_
                    `(a (@ (href "https://creativecommons.org/licenses/by-sa/4.0/"))
                        "CC-BY-SA 4.0 license."))))))))))