cssを使おう。

kahuaのチュートリアルとwiki-ikiのソースを元にcssを使う。アプリケーションの名前はblog。
まずは、templates/page.xmlのheadの部分を以下の行を追加。

  • templates/page.xml
  <head>
    <title id='title'>SAMPLE</title>
    <link  id='css' /><!-- 追加した行 -->
  </head>

次に、チュートリアルのstandard-pageを変更

(define (standard-page title css body)
  (kahua:xml-template->sxml
   page-template
   :title (title/ (@/ (id "title")) title)
   :css   (link/ (@/ (rel "stylesheet") (type "text/css")
		     (href (kahua-static-document-url
			    "blog/" css))))
   :body (div/ (@/ (id "body")) (h1/ title) body)))

kahua-static-document-urlはbuild-pathをつかって、kahuaのstatic-document-url(デフォルトではサイトバンドルのstaticディレクトリ)と、引数のディレクトリをくっつけている。

cssのインストール先はサイトバンドルのstaticディレクトリだったので、どうやって指定するのだろう?と思ったけど、実際は、そのつど取得していたわけだ。

使い方は、

(define-entry (sample)
  (standard-page "Sample" "blog.css"
		 empty))