aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2020-03-13 18:21:43 +0530
committerArun Isaac2020-03-13 18:21:43 +0530
commitd0c7b3114734765165be773945a14eec58faf352 (patch)
tree3e6adf502d962468aa3bce6afc9b13a01514dffd
parent188efd7f47ffd620aff8eecfe5d8fdd2fc9bf397 (diff)
downloadennum-d0c7b3114734765165be773945a14eec58faf352.tar.gz
ennum-d0c7b3114734765165be773945a14eec58faf352.tar.lz
ennum-d0c7b3114734765165be773945a14eec58faf352.zip
Publish interlanguage links only if there are translations.
* ennu-html.el (ennu-html-inner-template): Publish interlanguage links only if there are translations.
-rw-r--r--ennu-html.el25
1 files changed, 13 insertions, 12 deletions
diff --git a/ennu-html.el b/ennu-html.el
index f78f357..93dc221 100644
--- a/ennu-html.el
+++ b/ennu-html.el
@@ -231,18 +231,19 @@
:datetime ,(org-export-get-date info "%Y-%m-%d 12:00:00")
,(org-export-get-date info "%B %d, %Y"))))))))
;; Interlanguage language links
- (format "<p>In other languages: %s</p>"
- (mapconcat
- (lambda (translation)
- (let ((lang (ennu-post-language translation))
- (slug (ennu-post-slug translation)))
- (replace-regexp-in-string
- "<a " (format "<a hreflang=\"%s\" " lang)
- (ennu-export-post slug
- (map-elt ennu--iso-639-1-alist lang nil 'string=)
- (plist-get info :back-end)))))
- (plist-get info :translations)
- ", "))
+ (when-let (translations (plist-get info :translations))
+ (format "<p>In other languages: %s</p>"
+ (mapconcat
+ (lambda (translation)
+ (let ((lang (ennu-post-language translation))
+ (slug (ennu-post-slug translation)))
+ (replace-regexp-in-string
+ "<a " (format "<a hreflang=\"%s\" " lang)
+ (ennu-export-post slug
+ (map-elt ennu--iso-639-1-alist lang nil 'string=)
+ (plist-get info :back-end)))))
+ translations
+ ", ")))
;; Tags
(format "<p>Tags: %s</p>"
(mapconcat