ソースを参照

Add a title and treat static-pages as markdown.

Brit Butler 11 年 前
コミット
f1abdd5410
共有1 個のファイルを変更した8 個の追加2 個の削除を含む
  1. 8 2
      plugins/static-pages.lisp

+ 8 - 2
plugins/static-pages.lisp

@@ -12,10 +12,16 @@
12 12
 (in-package :coleslaw-static-pages)
13 13
 
14 14
 (defclass page (content)
15
-  ((url :initarg :url :reader page-url)))
15
+  ((title :initarg :title :reader page-title)
16
+   (url :initarg :url :reader page-url)))
17
+
18
+(defmethod initialize-instance :after ((object page) &key)
19
+  ;; Expect all static-pages to be written in Markdown for now.
20
+  (with-accessors ((text content-text)) object
21
+    (setf text (render-text text :md))))
16 22
 
17 23
 (defmethod render ((object page) &key next prev)
18
-  ;; For now, we'll re-use the normal post theme.
24
+  ;; For the time being, we'll re-use the normal post theme.
19 25
   (funcall (theme-fn 'post) (list :config *config*
20 26
                                   :post object)))
21 27