Commit a58be21e authored by Ludovic Courtès's avatar Ludovic Courtès

Show latest news on front page.

* getting-started.md: Nitpick.
* guix-hpc.scm (base-layout): Add #:posts and #:site.
[post->brief]: New procedure.
Use it to generate a "latest news" block on the front page.
(read-markdown-page): Add 'posts' and 'site' parameters and pass them to
'base-layout'.
(static-pages): Return lambdas.
* haunt.scm: Remove 'map' around 'static-pages' call.
* static/css/main.css (.latest-news): New.
(.news-brief): New.
parent df34d2ec
......@@ -175,7 +175,7 @@ You can have your personal package collection:
just
[add it to `$GUIX_PACKAGE_PATH`](https://www.gnu.org/software/guix/manual/html_node/Package-Modules.html).
# Sending Guix Packages to Guix-less Machines
# Sending Packages to Guix-less Machines
What if the target supercomputer lacks Guix? You can still enjoy Guix’s
reproducibility and customizability by [sending your package binaries
......
......@@ -19,6 +19,7 @@
#:use-module (syntax-highlight lexers)
#:use-module (sxml simple)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-19)
#:use-module (srfi srfi-26)
......@@ -87,7 +88,13 @@
((? string? str)
str)))
(define* (base-layout body #:key (title "Guix-HPC") (meta '()))
(define* (base-layout body #:key (title "Guix-HPC") (meta '())
(posts '()) site)
(define (post->brief post)
`(li (@ (class "news-brief"))
(a (@ (href ,(post-url post site)))
,(post-ref post 'title))))
`((doctype "html")
(html (@ (lang "en"))
(head
......@@ -131,6 +138,15 @@
(div (@ (id "content")
(class "width-control"))
(div (@ (id "content-inner"))
,@(if (assoc-ref meta 'frontpage)
`((div (@ (class "latest-news"))
"LATEST ARTICLES"
(ul ,@(map post->brief
(take (posts/reverse-chronological posts) 3))
(li (a (@ (href "/blog")) "More…")))))
'())
(article ,body)))
(div (@ (id "collaboration"))
......@@ -161,7 +177,7 @@
(define read-markdown
(reader-proc commonmark-reader))
(define (read-markdown-page file)
(define (read-markdown-page file posts site)
"Read the CommonMark page from FILE. Return its final SXML
representation."
(let-values (((meta body)
......@@ -171,12 +187,15 @@ representation."
,(syntax-highlight body)))
#:title (string-append "Guix-HPC — "
(assoc-ref meta 'title))
#:meta meta)))
#:meta meta
#:posts posts
#:site site)))
(define (static-pages)
(define (markdown-page html md)
(make-page html (read-markdown-page md)
sxml->html))
(lambda (site posts)
(make-page html (read-markdown-page md posts site)
sxml->html)))
(list (markdown-page "about/index.html" "about.md")
(markdown-page "index.html" "getting-started.md")))
......
......@@ -115,7 +115,4 @@ deployment for high-performance computing — Blog" ;title
(static-directory "static")
(map (lambda (page)
(lambda (site posts)
page))
(static-pages))))
(static-pages)))
......@@ -153,6 +153,18 @@ p + p {
}
.latest-news {
margin-top: 20px;
padding-top: 0px;
padding-bottom: 0px;
padding-left: 10pt;
border-left: solid 10px #ffbf2d;
color: #533;
}
.news-brief {
}
#collaboration {
border-top: solid 4px #aaaaaa;
border-bottom: solid 4px #aaaaaa;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment