From 06182430d98220c5ef994216f5031637a738d31b Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Mon, 12 Oct 2009 13:13:14 +0200 Subject: =?UTF-8?q?Add=20a=20=E2=80=9Ccanonical=E2=80=9D=20link=20to=20the?= =?UTF-8?q?=20index=20page.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ignore-this: 73714c5d314f5faedadd1063b4946d4d darcs-hash:a725dccc3ce111876d96a5cb9ef84fff3aa19e1c --- journal.lisp | 14 +++++++++----- macros.lisp | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/journal.lisp b/journal.lisp index a78e7a0..2669060 100755 --- a/journal.lisp +++ b/journal.lisp @@ -411,7 +411,7 @@ (<:as-is "Veröffentlichen")))))))) -(defun call-with-web-journal (page-title thunk &key post-id) +(defun call-with-web-journal (page-title thunk &key canonical-uri) ;; 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. @@ -452,8 +452,8 @@ (<: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") - (when post-id - (<:link :rel "canonical" :type "text/html" :href (link-to :view :post-id post-id :absolute t)))) + (when canonical-uri + (<:link :rel "canonical" :type "text/html" :href canonical-uri))) (<:body (<:div :id :main-title-box (<:h1 :id :main-title @@ -501,7 +501,11 @@ :save-entry)) (title-of (find-entry *post-number*)) nil) - :post-id (when (eq *action* :view) *post-number*)) + :canonical-uri (case *action* + (:view + (link-to :view :post-id post-id :absolute t)) + ((:index nil) + (link-to :index :absolute t)))) (case *action* ((:index nil) (let ((entries (select 'journal-entry @@ -739,7 +743,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 :post-id id) + (with-web-journal (title :canonical-uri (link-to :view :post-id post-id :absolute t)) (show-journal-entry entry :comments-p t)))))))) (defun update-atom-feed () diff --git a/macros.lisp b/macros.lisp index 0b516f4..4d0124a 100644 --- a/macros.lisp +++ b/macros.lisp @@ -41,8 +41,8 @@ (emit-close-tag "html")) -(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-web-journal ((page-title &key canonical-uri) &body body) + `(call-with-web-journal ,page-title #'(lambda () ,@body) :canonical-uri ,canonical-uri)) (defmacro with-result-cache ((cache-id &key (younger-than nil younger-than-p)) -- cgit v1.2.3