diff --git a/layouts/default.sxml b/layouts/default.sxml
deleted file mode 100644
index b99c9f5..0000000
--- a/layouts/default.sxml
+++ /dev/null
@@ -1,52 +0,0 @@
-;; Copyright (C) 2022 Ivan Polyakov
-;;
-;; This file is part of vilor's website.
-;;
-;; Vilor's website is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-;;
-;; Vilor's website is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see .
-
-()
-`((xhtml-1.0-strict)
- (html (@ (xmlns "http://www.w3.org/1999/xhtml") (xml:lang "en") (lang "en"))
- (head
- (meta (@ (http-equiv "Content-Type") (content "text/html; charset=ascii")))
- (link (@ (rel "stylesheet") (href "/style.css")))
- (title ,($ 'title)))
- (body
- (div (@ (class "wrapper"))
- (div (@ (class "header"))
- (div (@ (class "container"))
- (h4 (@ (class "header__logo")) vilor)
- (ul (@ (class "header__nav"))
- (li (a (@ (href "/index.html")) "Home"))
- (li (a (@ (href "/webapps/index.html")) "Web Apps"))
- (li (a (@ (href "http://31.184.254.176:8078/")) "Git"))
- (li (a (@ (href "/contacts.html")) "Contacts")))))
-
- (div (@ (class "content container"))
- (h1 (@ (class "content__title")) ,($ 'page-name))
- (div (@ (class "content__description")) ,($ 'page-desc))
- (inject ,contents))
-
- (div (@ (class "footer"))
- (div (@ (class "footer__authors"))
- (div "Content: " (a (@ (href "/contacts.html")) "Ivan Polyakov"))
- (div "Design: " (a (@ (href "https://t.me/olnaolna")) "Olga Revenkova")))
- (div (@ (class "links"))
- (a (@ (href "http://validator.w3.org/check?uri=referer"))
- (img (@ (src "http://www.w3.org/Icons/valid-xhtml10") (alt "Valid XHTML 1.0 Strict") (height 31) (width 88))))
- (a (@ (href "http://31.184.254.176:8078/vilor/website/"))
- "Source code")
- (a (@ (href "http://www.anybrowser.org/campaign/"))
- (img (@ (src "/img/anybrowser3.jpg")
- (alt "Viewable With Any Browser"))))))))))
diff --git a/src/components/footer.scm b/src/components/footer.scm
new file mode 100644
index 0000000..9caca21
--- /dev/null
+++ b/src/components/footer.scm
@@ -0,0 +1,38 @@
+;; Copyright (C) 2022 Ivan Polyakov
+;;
+;; This file is part of vilor's website.
+;;
+;; Vilor's website is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Vilor's website is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see .
+
+(define footer-links
+ '(("http://validator.w3.org/check?uri=referer" "XHTML 1.0")
+ ("https://call-cc.org/" "Made with Chicken Scheme")
+ ("http://31.184.254.176:8078/vilor/website/" "Source code")
+ ("http://www.anybrowser.org/campaign/" "Any Browser")))
+
+(define footer
+ `(div (@ (class "footer"))
+ (div (@ (class "footer__authors"))
+ (div "Content: "
+ (a (@ (href "/contacts.xhtml")) "Ivan Polyakov"))
+ (div "Design: "
+ (a (@ (href "https://t.me/olnaolna")) "Olga Revenkova")))
+
+ (div (@ (class "footer__links"))
+ ,(let ((idx -1))
+ (map (lambda (l)
+ (set! idx (+ idx 1))
+ `(,(if (> idx 0) '(" | ") '())
+ (a (@ (href ,(car l))) ,(cdr l))))
+ footer-links)))))
diff --git a/src/components/header.scm b/src/components/header.scm
new file mode 100644
index 0000000..e9025e8
--- /dev/null
+++ b/src/components/header.scm
@@ -0,0 +1,34 @@
+;; Copyright (C) 2022 Ivan Polyakov
+;;
+;; This file is part of vilor's website.
+;;
+;; Vilor's website is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Vilor's website is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see .
+
+(define header-links
+ '(("/index.xhtml" "Home")
+ ("/webapps/index.xhtml" "Web Apps")
+ ("http://31.184.254.176:8078/" "Git")
+ ("/contacts.xhtml" "Contacts")))
+
+(define header
+ `(div (@ (class "header"))
+ (div (@ (class "container"))
+ (h4 (@ (class "header__logo")) "vilor")
+ (span (@ (class "header__nav"))
+ ,(let ((idx -1))
+ (map (lambda (l)
+ (set! idx (+ idx 1))
+ `(,(if (> idx 0) '(" | ") '())
+ (a (@ (href ,(car l))) ,(cdr l))))
+ header-links))))))
diff --git a/layouts/clean.sxml b/src/general.scm
similarity index 68%
rename from layouts/clean.sxml
rename to src/general.scm
index d6cd069..02c404d 100644
--- a/layouts/clean.sxml
+++ b/src/general.scm
@@ -11,15 +11,9 @@
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
-;;
+;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see .
-()
-`((xhtml-1.0-strict)
- (html (@ (xmlns "http://www.w3.org/1999/xhtml") (xml:lang "en") (lang "en"))
- (head
- (meta (@ (http-equiv "Content-Type") (content "text/html; charset=ascii")))
- (link (@ (rel "stylesheet") (href "/style.css")))
- (title ,($ 'title)))
- (body (inject ,contents))))
+(define xhtml-1.0-doctype
+ "")
diff --git a/src/templates/clean.scm b/src/templates/clean.scm
new file mode 100644
index 0000000..bd16273
--- /dev/null
+++ b/src/templates/clean.scm
@@ -0,0 +1,39 @@
+;; Copyright (C) 2022 Ivan Polyakov
+;;
+;; This file is part of vilor's website.
+;;
+;; Vilor's website is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Vilor's website is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see .
+
+(define (clean-tpl
+ page-title
+ page-content
+ #!optional (page-styles '()) (page-scripts '()))
+ `(html (@ (xmlns "http://www.w3.org/1999/xhtml")
+ (xml:lang "en")
+ (lang "en"))
+ (head
+ (meta (@ (http-equiv "Content-Type")
+ (content "text/html; charset=ascii")))
+ (meta (@ (name "viewport")
+ (content "width=device-width, initial-scale=1")))
+
+ ,(map (lambda (l)
+ `(link (@ (rel "stylesheet") (href ,l))))
+ page-styles)
+
+ (title ,page-title))
+ (body
+ ,page-content
+
+ ,(map (lambda (l) `(script (@ (src ,l)))) page-scripts))))
diff --git a/src/templates/default.scm b/src/templates/default.scm
new file mode 100644
index 0000000..c37cbba
--- /dev/null
+++ b/src/templates/default.scm
@@ -0,0 +1,54 @@
+;; Copyright (C) 2022 Ivan Polyakov
+;;
+;; This file is part of vilor's website.
+;;
+;; Vilor's website is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Vilor's website is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see .
+
+(load "./src/components/header.scm")
+(load "./src/components/footer.scm")
+
+(define (default-tpl
+ page-title
+ page-content
+ page-name
+ page-desc
+ #!optional (page-styles '()) (page-scripts '()))
+ `(html (@ (xmlns "http://www.w3.org/1999/xhtml")
+ (xml:lang "en")
+ (lang "en"))
+ (head
+ (meta (@ (http-equiv "Content-Type")
+ (content "text/html; charset=ascii")))
+ (meta (@ (name "viewport")
+ (content "width=device-width, initial-scale=1")))
+
+ ,(map (lambda (l)
+ `(link (@ (rel "stylesheet") (href ,l))))
+ page-styles)
+
+ (link (@ (rel "stylesheet") (href "/style.css")))
+
+ (title ,title))
+ (body
+ ,header
+ (hr (@ (style "display: none")))
+
+ (div (@ (class "content container"))
+ (h1 (@ (class "content__title")) ,page-name)
+ (div (@ (class "content__description")) ,page-desc)
+ ,page-content)
+
+ (hr (@ (style "display: none")))
+ ,footer
+ ,(map (lambda (l) `(script (@ (src ,l)))) page-scripts))))