summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2009-10-11 23:05:46 +0200
committerMatthias Benkard <code@mail.matthias.benkard.de>2009-10-11 23:05:46 +0200
commit51275a6551214a734976e079932d8a4a25c898ef (patch)
tree3e2b26fe80465964f06b2f303e58f9613ae1f139
parent41cfdbf9dd76b7219d6b55aebd1667a23f46d897 (diff)
Add link metainformation of type “canonical” to journal entry pages.
Ignore-this: 6f30d444f075ceffa6b73dcbbec859d9 darcs-hash:780d6e4ba21d87f3317c1e30eee3a4fcef261e2b
-rwxr-xr-xjournal.lisp11
-rw-r--r--macros.lisp4
2 files changed, 9 insertions, 6 deletions
diff --git a/journal.lisp b/journal.lisp
index ad371b7..488ef43 100755
--- a/journal.lisp
+++ b/journal.lisp
@@ -411,7 +411,7 @@
(<:as-is "Ver&ouml;ffentlichen"))))))))
-(defun call-with-web-journal (page-title thunk)
+(defun call-with-web-journal (page-title thunk &key post-id)
;; TODO: Check how to make Squid not wait for the CGI script's
;; termination, which makes generating a Last-Modified header
;; feel slower to the end user rather than faster.
@@ -444,7 +444,9 @@
:title "Kompottkins Weisheiten")
(<:link :rel "stylesheet" :type "text/css" :href (link-to :css))
(<:link :rel "openid.server" :href "https://meinguter.name/index.php/serve")
- (<:link :rel "openid.delegate" :href "https://matthias.benkard.meinguter.name"))
+ (<:link :rel "openid.delegate" :href "https://matthias.benkard.meinguter.name")
+ (when post-id
+ (<:link :rel "canonical" :type "text/html" :href (link-to :view :post-id post-id))))
(<:body
(<:div :id :main-title-box
(<:h1 :id :main-title
@@ -491,7 +493,8 @@
(with-web-journal ((if (member *action* '(:view :edit :preview :post-comment
:save-entry))
(title-of (find-entry *post-number*))
- nil))
+ nil)
+ :post-id (when (eq *action* :view) *post-number*))
(case *action*
((:index nil)
(let ((entries (select 'journal-entry
@@ -729,7 +732,7 @@
(with-open-file (*standard-output* file-path :direction :output :if-exists :supersede)
(with-yaclml-stream *standard-output*
(let ((*mode* :file))
- (with-web-journal (title)
+ (with-web-journal (title :post-id id)
(show-journal-entry entry :comments-p t))))))))
(defun update-atom-feed ()
diff --git a/macros.lisp b/macros.lisp
index ad4dc4b..bfc3495 100644
--- a/macros.lisp
+++ b/macros.lisp
@@ -38,8 +38,8 @@
(emit-close-tag "html"))
-(defmacro with-web-journal ((page-title) &body body)
- `(call-with-web-journal ,page-title #'(lambda () ,@body)))
+(defmacro with-web-journal ((page-title &key post-id) &body body)
+ `(call-with-web-journal ,page-title #'(lambda () ,@body) :post-id post-id))
(defmacro with-result-cache ((cache-id &key (younger-than nil younger-than-p))