summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2023-10-04 17:38:56 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2023-10-04 17:38:56 +0200
commit1cdb1ecdc6ed213caeebf6e34969f7527fac55ef (patch)
treeda6c4a71636e9a6c9a76a0a0bf427eabd4273c54
parent6fa758a07de91bdf2ec2fafb5bd757f9c6a114f5 (diff)
html: add long and short descriptions
-rw-r--r--src/html.scm13
-rw-r--r--tests/html.scm4
2 files changed, 10 insertions, 7 deletions
diff --git a/src/html.scm b/src/html.scm
index 7c0485f..568f885 100644
--- a/src/html.scm
+++ b/src/html.scm
@@ -12,10 +12,11 @@
js))
(define-record-type <index>
- (make-index title description uri author posts styles scripts)
+ (make-index title short-description long-description uri author posts styles scripts)
index?
(title index-title)
- (description index-description)
+ (short-description index-short-description)
+ (long-description index-long-description)
(uri index-uri)
(author index-author)
(posts index-posts)
@@ -61,14 +62,15 @@
(define* (index #:key (title "")
- (description "")
+ (short-description "")
+ (long-description "")
(uri "")
(author (person ""))
(posts '())
(styles '())
(scripts '())
#:allow-other-keys)
- (make-index title description uri author posts styles scripts))
+ (make-index title short-description long-description uri author posts styles scripts))
(define* (post #:key (id #f)
@@ -151,9 +153,10 @@
(meta (@(name "viewport")
(content "width=device-width, initial-scale=1")))
(meta (@(name "description")
- (content ,(index-description index))))
+ (content ,(index-short-description index))))
,@(map render-style (index-styles index)))
(body
+ (section (@(class description)) ,(index-long-description index))
,@(map render-post (index-posts index))
,@(map render-script (index-scripts index)))))
diff --git a/tests/html.scm b/tests/html.scm
index ca041f4..561dc67 100644
--- a/tests/html.scm
+++ b/tests/html.scm
@@ -30,7 +30,7 @@
(let ((html-index (with-output-to-string (lambda () (html:render index)))))
- (test-assert (string=? html-index
- "<!DOCTYPE html><html><head><meta author=\"Ekaitz\" /><meta charset=\"utf-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /><meta name=\"description\" content=\"Este es mi feed\" /><style>body {color: grey}</style><link rel=\"stylesheet\" href=\"/that.css\" /></head><body><article class=\"post\" id=\"first-entry\"><h2>first entry</h2><time datetime=\"2023-03-01T00:00:00+0100\" pubdate=\"#t\">2023-03-01T00:00:00+0100</time><address class=\"author\"><a rel=\"author\">Ekaitz</a></address><section class=\"summary\"><p>Este es el resumen</p></section><section class=\"content\"><p>Este es el contenido</p></section></article><script>console.log(\"HOLA\")</script><script src=\"/script.js\" /></body></html>")))
+ (test-assert (string=? (pk html-index)
+ "<!DOCTYPE html><html><head><meta author=\"Ekaitz\" /><meta charset=\"utf-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /><meta name=\"description\" content=\"\" /><style>body {color: grey}</style><link rel=\"stylesheet\" href=\"/that.css\" /></head><body><section class=\"description\"></section><article class=\"post\" id=\"first-entry\"><h2>first entry</h2><time datetime=\"2023-03-01T00:00:00+0100\" pubdate=\"#t\">2023-03-01T00:00:00+0100</time><address class=\"author\"><a rel=\"author\">Ekaitz</a></address><section class=\"summary\"><p>Este es el resumen</p></section><section class=\"content\"><p>Este es el contenido</p></section></article><script>console.log(\"HOLA\")</script><script src=\"/script.js\" /></body></html>")))
(test-end "HTML index page")