Hey, look! User-defined routes are easy. Slot-value is gross though.
This commit is contained in:
parent
e5a40b67a7
commit
f56270430f
3 changed files with 25 additions and 1 deletions
|
@ -3,6 +3,12 @@
|
||||||
:domain "http://blub.co.za"
|
:domain "http://blub.co.za"
|
||||||
:feeds ("lisp")
|
:feeds ("lisp")
|
||||||
:plugins ((mathjax))
|
:plugins ((mathjax))
|
||||||
|
:routing ((:post "posts/~a")
|
||||||
|
(:tag-index "tag/~a")
|
||||||
|
(:month-index "date/~a")
|
||||||
|
(:numeric-index "~d")
|
||||||
|
(:feed "~a.xml")
|
||||||
|
(:tag-feed "tag/~a.xml"))
|
||||||
:sitenav ((:url "http://twitter.com/ralph_moeritz" :name "Twitter")
|
:sitenav ((:url "http://twitter.com/ralph_moeritz" :name "Twitter")
|
||||||
(:url "http://github.com/ralph-moeritz" :name "Code"))
|
(:url "http://github.com/ralph-moeritz" :name "Code"))
|
||||||
:staging-dir "/tmp/coleslaw"
|
:staging-dir "/tmp/coleslaw"
|
||||||
|
@ -13,6 +19,12 @@
|
||||||
:domain "http://musings.co.za"
|
:domain "http://musings.co.za"
|
||||||
:feeds ("opinion")
|
:feeds ("opinion")
|
||||||
:plugins ((mathjax))
|
:plugins ((mathjax))
|
||||||
|
:routing ((:post "posts/~a")
|
||||||
|
(:tag-index "tag/~a")
|
||||||
|
(:month-index "date/~a")
|
||||||
|
(:numeric-index "~d")
|
||||||
|
(:feed "~a.xml")
|
||||||
|
(:tag-feed "tag/~a.xml"))
|
||||||
:sitenav ((:url "http://twitter.com/ralph_moeritz" :name "Twitter")
|
:sitenav ((:url "http://twitter.com/ralph_moeritz" :name "Twitter")
|
||||||
(:url "http://github.com/ralph-moeritz" :name "Code"))
|
(:url "http://github.com/ralph-moeritz" :name "Code"))
|
||||||
:staging-dir "/tmp/coleslaw"
|
:staging-dir "/tmp/coleslaw"
|
||||||
|
|
|
@ -7,6 +7,12 @@
|
||||||
(disqus :shortname "my-site-name")
|
(disqus :shortname "my-site-name")
|
||||||
(analytics :tracking-code "foo"))
|
(analytics :tracking-code "foo"))
|
||||||
:repo "/home/git/tmp/improvedmeans/"
|
:repo "/home/git/tmp/improvedmeans/"
|
||||||
|
:routing ((:post "posts/~a")
|
||||||
|
(:tag-index "tag/~a")
|
||||||
|
(:month-index "date/~a")
|
||||||
|
(:numeric-index "~d")
|
||||||
|
(:feed "~a.xml")
|
||||||
|
(:tag-feed "tag/~a.xml"))
|
||||||
:sitenav ((:url "http://redlinernotes.com/" :name "Home")
|
:sitenav ((:url "http://redlinernotes.com/" :name "Home")
|
||||||
(:url "http://twitter.com/redline6561" :name "Twitter")
|
(:url "http://twitter.com/redline6561" :name "Twitter")
|
||||||
(:url "http://github.com/redline6561" :name "Code")
|
(:url "http://github.com/redline6561" :name "Code")
|
||||||
|
|
|
@ -27,7 +27,13 @@
|
||||||
;; Instance Methods
|
;; Instance Methods
|
||||||
|
|
||||||
(defgeneric page-url (document)
|
(defgeneric page-url (document)
|
||||||
(:documentation "The url to the DOCUMENT without the domain."))
|
(:documentation "The url to the DOCUMENT without the domain.")
|
||||||
|
(:method (document)
|
||||||
|
(let* ((class-name (class-name (class-of document)))
|
||||||
|
(route (assoc class-name (routing *config*))))
|
||||||
|
(if route
|
||||||
|
(format nil (second route) (slot-value document 'slug))
|
||||||
|
(error "No routing method found for: ~A" class-name)))))
|
||||||
|
|
||||||
(defmethod page-url :around ((document t))
|
(defmethod page-url :around ((document t))
|
||||||
(let ((result (call-next-method)))
|
(let ((result (call-next-method)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue