source: haunt.scm@ 1cace5c

Last change on this file since 1cace5c was 1cace5c, checked in by Mikhail Kirillov <w96k@…>, on Sep 27, 2019 at 1:21:14 AM

Change text-align & width

  • Property mode set to 100644
File size: 7.3 KB
Line 
1;;; ;;;; My Blog made in Guile Haunt
2;;;;
3;;;; https://w96k.com/
4;;;; 2019 (c) Mikhail w96k Kirillov
5
6(use-modules (haunt site)
7 (haunt reader)
8 (haunt asset)
9 (haunt page)
10 (haunt post)
11 (haunt html)
12 (haunt utils)
13 (haunt builder blog)
14 (haunt builder atom)
15 (haunt builder assets)
16 (srfi srfi-19)
17 (ice-9 rdelim)
18 (ice-9 match)
19 (web uri))
20
21(define (stylesheet name)
22 `(link (@ (rel "stylesheet")
23 (href ,(string-append "/css/" name ".css")))))
24
25(define (anchor content uri)
26 `(a (@ (href ,uri)) ,content))
27
28(define (logo src)
29 `(img (@ (class "logo") (src ,(string-append "/images/" src)))))
30
31(define %cc-by-sa-link
32 '(a (@ (href "https://creativecommons.org/licenses/by-sa/4.0/"))
33 (img (@ (src "/images/cc.png")))))
34
35(define %gpl-logo
36 '(a (@ (href "https://www.gnu.org/licenses/gpl-3.0.txt"))
37 (img (@ (src "/images/gpl.png")))))
38
39(define mini-theme
40 (theme #:name "Mini"
41 #:layout
42 (lambda (site title body)
43 `((doctype "html")
44 (head
45 (meta (@ (charset "utf-8")))
46 (title ,(string-append title " — " (site-title site)))
47 ,(stylesheet "mini")
48 ,(stylesheet "custom"))
49 (body
50 (header (@ (class "navbar"))
51 (a (@ (href "/")
52 (class "logo"))
53 ,(string-append (site-title site)))
54 (a (@ (class "button") (href "/about.html")) "Обо мне")
55 (a (@ (class "button") (href "https://github.com/w96k/cv/raw/master/cv.pdf")) "CV")
56 (a (@ (class "button") (href "/feed.xml"))
57 (span (@ (class "icon-rss"))))
58 )
59 (div (@ (class "container"))
60 ,body)
61 (footer
62 (p (small "Работает на "
63 (a (@ (href "https://dthompson.us/projects/haunt.html"))
64 Haunt)
65 " при помощи "
66 (a (@ (href "https://www.gnu.org/software/guile/"))
67 "Guile Scheme")))
68 (p (small (a (@ (href "https://gitlab.com/w96k/blog")) "Исходный код") " © 2019 Mikhail Kirillov"))
69 (p (,%gpl-logo) " " (,%cc-by-sa-link))))))
70 #:post-template
71 (lambda (post)
72 `(article
73 (h2 ,(post-ref post 'title)
74 (small (span (@ (class "icon-calendar"))) " " ,(date->string* (post-date post))))
75 (div ,(post-sxml post))))
76 #:collection-template
77 (lambda (site title posts prefix)
78 (define (post-uri post)
79 (string-append "/" (or prefix "")
80 (site-post-slug site post) ".html"))
81
82 `((h2 "Посты")
83 (ul
84 ,@(map (lambda (post)
85 `(li
86 (a (@ (href ,(post-uri post)))
87 ,(post-ref post 'title))))
88 (posts/reverse-chronological posts)))))))
89
90(define (about-page site posts)
91 (define body
92 `((article (@ (id "about"))
93 (div (@ (class "row"))
94 (div (@ (class "col-sm-12 col-md-3"))
95 (img (@ (src "/images/ava.jpg")
96 (class "shadowed rounded")
97 (style "max-width: 300px; width: 100%;")))
98 (div (img (@ (src "/images/fsf.png")
99 (class "shadowed rounded")))))
100
101 (div (@ (class "col-sm-12 col-md-9"))
102 (h2 "Кириллов Михаил")
103 (p "Я — фуллстек разработчик. Люблю функциональное
104программирование, LISP и движение за свободное программное
105обеспечение.")
106
107 (p "Вы можете мне написать на почту с вопросом или
108темой для
109поста " (a (@ (href "mailto:w96k@member.fsf.org")) "w96k@member.fsf.org")))))))
110
111 (make-page "about.html"
112 (with-layout mini-theme site "Обо мне" body)
113 sxml->html))
114
115(define (redirect-dobryakov site posts)
116 (define body
117 `((article
118 (meta (@
119 (http-equiv "refresh")
120 (content "0; url=/григорий-добряков-об-устройстве-на-работу.html")))
121 (h2 "Перенаправляю...")
122 (p (a (@ (href "/григорий-добряков-об-устройстве-на-работу.html"))
123 "Нажмите если не перенаправилось"))
124 )))
125
126 (make-page "dobryakov_employment.html"
127 (with-layout mini-theme site "Редирект" body)
128 sxml->html))
129
130(define (redirect-pirogov site posts)
131 (define body
132 `((article
133 (meta (@
134 (http-equiv "refresh")
135 (content "0; url=/алексей-пирогов-про-фп.html")))
136 (h2 "Перенаправляю...")
137 (p (a (@ (href "/алексей-пирогов-про-фп.html"))
138 "Нажмите если не перенаправилось"))
139 )))
140
141 (make-page "pirogov_fp.html"
142 (with-layout mini-theme site "Редирект" body)
143 sxml->html))
144
145(define (redirect-libreboot site posts)
146 (define body
147 `((article
148 (meta (@
149 (http-equiv "refresh")
150 (content "0; url=/libreboot-x200t.html")))
151 (h2 "Перенаправляю...")
152 (p (a (@ (href "/libreboot-x200t.html"))
153 "Нажмите если не перенаправилось"))
154 )))
155
156 (make-page "libreboot_x200t.html"
157 (with-layout mini-theme site "Редирект" body)
158 sxml->html))
159
160(define (404-page site posts)
161 (define body
162 `((article (@ (style "text-align: center;"))
163 (h2 "Ошибка 404"
164 (small "Страница не найдена"))
165
166 (div
167 (a (@ (class "button")
168 (href "/"))
169 "На главную"))
170
171 (img (@ (id "youmu")
172 (src "/images/youmu.png")))
173 )))
174
175 (make-page "404.html"
176 (with-layout mini-theme site "Not Found" body)
177 sxml->html))
178
179(define %collections
180 `(("Главная" "index.html" ,posts/reverse-chronological)))
181
182(site #:title "@w96k"
183 #:domain "w96k.com"
184 #:default-metadata
185 '((author . "Mikhail Kirillov")
186 (email . "w96k@member.fsf.org"))
187 #:readers (list sxml-reader html-reader)
188 #:builders (list (blog #:theme mini-theme #:collections %collections)
189 (atom-feed)
190 (atom-feeds-by-tag)
191 about-page
192 redirect-dobryakov
193 redirect-pirogov
194 redirect-libreboot
195 404-page
196 (static-directory "images")
197 (static-directory "css")
198 (static-directory "js")))
Note: See TracBrowser for help on using the repository browser.