summaryrefslogtreecommitdiffstats
path: root/apps/blog/templates/post.scm
diff options
context:
space:
mode:
Diffstat (limited to 'apps/blog/templates/post.scm')
-rw-r--r--apps/blog/templates/post.scm69
1 files changed, 69 insertions, 0 deletions
diff --git a/apps/blog/templates/post.scm b/apps/blog/templates/post.scm
new file mode 100644
index 0000000..8a4880d
--- /dev/null
+++ b/apps/blog/templates/post.scm
@@ -0,0 +1,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."))))))))))