]> git.jsancho.org Git - blog.git/blob - haunt.scm
About page
[blog.git] / haunt.scm
1 (use-modules (haunt asset)
2              (haunt builder blog)
3              (haunt builder atom)
4              (haunt builder assets)
5              (haunt html)
6              (haunt page)
7              (haunt reader)
8              (haunt reader texinfo)
9              (haunt site)
10              (haunt post)
11              (srfi srfi-1)
12              (srfi srfi-19))
13
14 (define (stylesheet name)
15   `(link (@ (rel "stylesheet")
16             (href ,(string-append "css/" name ".css")))))
17
18 (define (static-page title file-name body)
19   (lambda (site posts)
20     (make-page file-name
21                (with-layout flex-theme site title body)
22                sxml->html)))
23
24 (define flex-theme
25   (theme #:name "Flex"
26          #:layout
27          (lambda (site title body)
28            `((doctype "html")
29              (html
30               (head
31                (meta (@ (charset "utf-8")))
32                (title ,(string-append title " - " (site-title site)))
33                (link (@ (rel "stylesheet") (href "//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic")))
34                ,(stylesheet "style.min")
35                ,(stylesheet "monokai.min")
36                ,(stylesheet "font-awesome.min")
37                ,(stylesheet "custom")
38                (meta (@ (name "viewport") (content "width=device-width, initial-scale=1.0"))))
39               (body
40                ,(let ((metadata (site-default-metadata site)))
41                   `(aside
42                     (div
43                      (a (@ (href "index.html")) (img (@ (src ,(assoc-ref metadata 'picture)))))
44                      (h1 (a (@ (href "index.html")) ,(assoc-ref metadata 'author)))
45                      (p ,(assoc-ref metadata 'description))
46                      (nav
47                       (ul (@ (class "list"))
48                           ,@(map (lambda (page)
49                                    `(li (a (@ (href ,(cdr page))) ,(car page))))
50                                  (assoc-ref metadata 'pages))))
51                      (ul (@ (class "social"))
52                          (li (a (@ (class "sc-linkedin") (target "_blank") (href "")) (i (@ (class "fa fa-linkedin")))))
53                          " "
54                          (li (a (@ (class "sc-github") (target "_blank") (href "")) (i (@ (class "fa fa-github")))))
55                          " "
56                          (li (a (@ (class "sc-twitter") (target "_blank") (href "")) (i (@ (class "fa fa-twitter")))))
57                          " "
58                          (li (a (@ (class "sc-rss") (target "_blank") (href "feed.xml")) (i (@ (class "fa fa-rss")))))))))
59                (main ,body)))))
60
61          #:post-template
62          (lambda (post)
63            (define (get-tags post)
64              (or (assoc-ref (post-metadata post) 'tags) '()))
65
66            `((article (@ (class "single"))
67                       (header
68                        (h1 ,(post-ref post 'title))
69                        (p "Publicado el " ,(date->string (post-date post) "~d/~m/~Y")))
70                       ,(post-sxml post)
71                       (div (@ (class "tag-cloud"))
72                            (p
73                             ,@(map (lambda (tag)
74                                      `((a (@ (href "")) ,tag) " "))
75                                    (get-tags post)))))))
76
77          #:collection-template
78          (lambda (site title posts prefix)
79            (define (post-uri post)
80              (string-append (or prefix "")
81                             (site-post-slug site post) ".html"))
82
83            (define (get-paragraphs sxml count)
84              (let ((pars (filter
85                           (lambda (e) (and (pair? e) (eq? (car e) 'p)))
86                           sxml)))
87                (list-head pars (min count (length pars)))))
88                      
89            (define (post-summary post)
90              (or (post-ref post 'summary)
91                  (get-paragraphs (cdr (post-sxml post)) 3)))
92
93            `(
94              ,@(map (lambda (post)
95                       `(article
96                         (header
97                          (h2
98                           (a (@ (href ,(post-uri post)))
99                              ,(post-ref post 'title)))
100                          (p "Publicado el " ,(date->string (post-date post) "~d/~m/~Y")))
101                         (div ,(post-summary post)
102                              (br)
103                              (a (@ (class "btn") (href ,(post-uri post))) " Seguir leyendo "))
104                         (hr)))
105                     (posts/reverse-chronological posts))))))
106
107 (define about-page
108   (static-page
109    "Sobre mi"
110    "about.html"
111    `((div
112       (article
113        (header (h2 "Sobre mi"))
114        (p "Conocí GNU/Linux y el software libre durante mis estudios universitarios en la " (a (@ (href "http://www.uji.es/")) "Universitat Jaume I") " y desde entonces mi compromiso con esas ideas ha ido en aumento.")
115        (p "Fue en 2003 cuando empecé como activista, participando en eventos relacionados con el software libre, manifestaciones en contra de las patentes de software, charlas y jornadas informativas en parties, institutos, etc.")
116        (p "Disfruto programando y lo hago con el lenguaje que más se ajuste a mis necesidades (Python, PHP, Golang, Erlang, ...). Durante muchos años mi lenguaje favorito fue C, aunque con el tiempo ese lugar privilegiado han pasado a ocuparlo Lisp y Scheme a partes iguales. Soy un enamorado del paradigma funcional.")
117        (p "Estoy casado con una mujer maravillosa y tengo un hijo que no deja de sorprenderme cada día. Son mi mayor alegría."))))))
118
119 (define %collections
120   `(("Home" "index.html" ,posts/reverse-chronological)))
121
122 (site #:title "Javier Sancho"
123       #:domain "jsancho.org"
124       #:build-directory "site-spanish"
125       #:default-metadata
126       '((author . "Javier Sancho")
127         (description . "Evangelizador del software libre - Programador")
128         (email . "jsf@jsancho.org")
129         (picture . "images/jsancho.jpg")
130         (pages . (("sobre mi" . "about.html")
131                   ("proyectos" . "http://git.jsancho.org/"))))
132       #:readers (list sxml-reader html-reader)
133       #:builders (list (blog #:theme flex-theme #:collections %collections)
134                        (atom-feed)
135                        (atom-feeds-by-tag)
136                        about-page
137                        (static-directory "images")
138                        (static-directory "fonts")
139                        (static-directory "css")))