Explorar el Código

Add taglinks to individual posts.

Brit Butler hace 13 años
padre
commit
98ae73ddd3
Se han modificado 3 ficheros con 8 adiciones y 5 borrados
  1. 3 3
      src/indices.lisp
  2. 1 1
      src/posts.lisp
  3. 4 1
      themes/hyde/post.tmpl

+ 3 - 3
src/indices.lisp

@@ -10,9 +10,9 @@
10 10
   (reduce (lambda (x y) (union x y :test #'string=))
11 11
           (mapcar #'post-tags (hash-table-values *posts*))))
12 12
 
13
-(defun taglinks ()
14
-  "Generate links to all the tag indices."
15
-  (loop for tag in (sort (all-tags) #'string<)
13
+(defun taglinks (&optional tags)
14
+  "Generate links to all the tag indices or those in TAGS."
15
+  (loop for tag in (or tags (sort (all-tags) #'string<))
16 16
      collect (list :url (format nil "~a/tag/~a.html" (domain *config*) tag)
17 17
                    :name tag)))
18 18
 

+ 1 - 1
src/posts.lisp

@@ -66,7 +66,7 @@
66 66
   (render-page (post-url post)
67 67
                (funcall (theme-fn "POST")
68 68
                         (list :title (post-title post)
69
-                              :tags (post-tags post)
69
+                              :tags (taglinks (post-tags post))
70 70
                               :date (post-date post)
71 71
                               :content (render-content (post-content post)
72 72
                                                        (post-format post))

+ 4 - 1
themes/hyde/post.tmpl

@@ -4,7 +4,10 @@
4 4
 <div class="article-meta">{\n}
5 5
   <h1 class="title">{$title}</h1>{\n}
6 6
   <div class="tags">{\n}
7
-    Tagged as {$tags}
7
+    Tagged as {foreach $tag in $tags}
8
+                <a href="{$tag.url |noAutoescape}">{$tag.name}</a>
9
+                    {if not isLast($tag)}, {/if}
10
+              {/foreach}
8 11
   </div>{\n}
9 12
   <div class="date">{\n}
10 13
     Written on {$date}