(defmacro defpage (name (uri &optional title) &body body)
`(define-easy-handler (,name :uri ,uri) ()
(with-html
(:html
(:head (:title (or ,title (string-titlize ,uri))))
(:body
(:div :id "container"
,@body))))))
Usage: (defpage aboutus ("/aboutus" "About Hacker News")
(:h3 "Hacker News Consists of the following people:")
(:ul :id "user-list"
(dolist (user (list-all-users))
(htm (:il user)))))
The one I use for my current project is 2 pages long and even generates SEO-friendly meta tags from the text content. In the future, I intend to make it index each page into a Common Lisp search engine (Montezuma) so I can search my entire site whenever I want.I slice and dice CSS and html until I like the page layout, then abstract the common parts and put them in DEFPAGE. I even have session-based stuff that shows a login/logout stuff on the top of each page in tiny font, so logged in users can view the public pages and know they're still logged in.
[Edit: Tonight I wrote self-validating CLOS objects that map to a database record. They generate their own Lisp and Javascript validators and the validators are auto-invoked both on the client and the server whenever their respective object is instantiated. On the javascript side, instanciation is attached to the :action of a form; it's clean and pretty, but forces me to use a seperate form for each class/table. I only came up with the idea this afternoon, so give it some time.]