Search code examples
htmlweblisphunchentoot

there are something wrong when i use lisp to build up my web


When I wrote my web page, I chose to use common lisp to build it up. But all I get is a web page's source code. But when I copy the web page to my emacs and reopen it, it works. I don't know what is wrong.

My code in lisp is

(defmacro standard-page ((&key title) &body body)

(with-html-output-to-string(*standard-output* nil :prologue t :indent t)

 (:html :xmlns "http://www.w3.org/1999/xhtml"
    :xml\:lang "en"
    :lang "en"
    (:head 
     (:meta :http-equiv "Content-Type" :content "text/html;charset=utf-8")
     (:title ,title)
     (:link :type "text/css" :rel "stylesheet" :href "/site.css"))
    (:body
     ,@body))))

(hunchentoot:define-easy-handler (hello :uri "/hello") (name) 
  (setf (hunchentoot:content-type*) "text/plain")
  (standard-page (:title "something new")
          (:h1 "can i do this?")))

Solution

  • This looks wrong:

      (setf (hunchentoot:content-type*) "text/plain")
    

    I think that should be text/html instead of text/plain.