summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2023-10-09 19:46:54 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2023-10-09 19:46:54 +0200
commitc65bf6c1e2af514da5322376a7602ea3be80cda1 (patch)
treea53f8a3728fd153f854cc215feded27c32f57111
parentdc7202a0338126cef3a756dc6761eb0c3885078e (diff)
html: add atom link
-rw-r--r--README.md1
-rw-r--r--src/html.scm12
2 files changed, 11 insertions, 2 deletions
diff --git a/README.md b/README.md
index 2f4f0a7..32d46a3 100644
--- a/README.md
+++ b/README.md
@@ -45,6 +45,7 @@ You have the following constructs to generate your site:
- `#:title`: `string`.
- `#:subtitle`: `string`.
- `#:uri`: URI of main document to insert in Atom. It's a `string`.
+ - `#:atom-feed-uri`: URI of Atom feed to link from HTML. It's a `string`.
- `#:posts`: posts of your website. Used form Atom to create entries of your
feed. It's a `list` of `post`s.
- `#:updated`: date of the latest update of your site. If nothing is added
diff --git a/src/html.scm b/src/html.scm
index 568f885..707ef2f 100644
--- a/src/html.scm
+++ b/src/html.scm
@@ -12,12 +12,13 @@
js))
(define-record-type <index>
- (make-index title short-description long-description uri author posts styles scripts)
+ (make-index title short-description long-description uri atom-feed-uri author posts styles scripts)
index?
(title index-title)
(short-description index-short-description)
(long-description index-long-description)
(uri index-uri)
+ (atom-feed-uri index-atom-feed-uri)
(author index-author)
(posts index-posts)
(styles index-styles)
@@ -65,12 +66,13 @@
(short-description "")
(long-description "")
(uri "")
+ (atom-feed-uri #f)
(author (person ""))
(posts '())
(styles '())
(scripts '())
#:allow-other-keys)
- (make-index title short-description long-description uri author posts styles scripts))
+ (make-index title short-description long-description uri atom-feed-uri author posts styles scripts))
(define* (post #:key (id #f)
@@ -154,8 +156,14 @@
(content "width=device-width, initial-scale=1")))
(meta (@(name "description")
(content ,(index-short-description index))))
+ ,(if (not (index-atom-feed-uri index))
+ `()
+ `(link (@(rel "alternate")
+ (type "application/atom+xml")
+ (href ,(index-atom-feed-uri index)))))
,@(map render-style (index-styles index)))
(body
+ (h1 (@(class title)) ,(index-title index))
(section (@(class description)) ,(index-long-description index))
,@(map render-post (index-posts index))
,@(map render-script (index-scripts index)))))