summaryrefslogtreecommitdiff
path: root/haunt
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.org>2023-08-27 18:56:02 -0400
committerJakob L. Kreuze <zerodaysfordays@sdf.org>2023-08-27 18:56:02 -0400
commitc0b1efb4fec8e677d2e00a949dcf834f94243f6e (patch)
treef85be8e9bf6864e07af4d473ac21bc75a6ded319 /haunt
parente2e9114efb474efe7c69fc2ee7feb1707267b6b1 (diff)
[atom] Allow relative URLs for Tor/i2p mirrors
Diffstat (limited to 'haunt')
-rw-r--r--haunt/jakob/builder/atom.scm19
1 files changed, 12 insertions, 7 deletions
diff --git a/haunt/jakob/builder/atom.scm b/haunt/jakob/builder/atom.scm
index ea2cfd1..81dd78e 100644
--- a/haunt/jakob/builder/atom.scm
+++ b/haunt/jakob/builder/atom.scm
@@ -29,6 +29,9 @@
#:use-module (web uri)
#:export (atom-feed))
+;; Slight hack to use relative URLs in the Atom feed for Tor and i2p mirrors.
+(define %disable-compliance (make-parameter (getenv "DISABLE_ATOM_COMPLIANCE")))
+
(define (format-date date)
"Format DATE into a date-time production as defined in RFC 3339"
(let* ((formatted (date->string date "~4"))
@@ -38,13 +41,15 @@
(define (format-relative-path site path)
"Return an absolute URI for PATH"
- (let ((path (if (not (string-prefix? "/" path))
- (format #f "/~a" path)
- path)))
- (uri->string
- (build-uri 'https ;; (site-scheme site)
- #:host (site-domain site)
- #:path path))))
+ (if (%disable-compliance)
+ path
+ (let ((path (if (not (string-prefix? "/" path))
+ (format #f "/~a" path)
+ path)))
+ (uri->string
+ (build-uri 'https ;; (site-scheme site)
+ #:host (site-domain site)
+ #:path path)))))
(define* (post->atom-entry site post #:key (blog-prefix ""))
"Convert POST into an Atom <entry> XML node."