File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ layout: default
3
+ ---
4
+ < h2 class ="post_title "> {{page.title}}</ h2 >
5
+ < ul >
6
+ {% for post in site.posts %}
7
+ {% for tag in post.tags %}
8
+ {% if tag == page.tag %}
9
+ < li class ="archive_list ">
10
+ < time style ="color:#666;font-size:11px; " datetime ='{.{post.date | date: "%Y-%m-%d"}} '> {{post.date | date: "%m/%d/%y"}}</ time > < a class ="archive_list_article_link " href ='{.{post.url}} '> {{post.title}}</ a >
11
+ < p class ="summary "> {{post.summary}}</ p >
12
+ < ul class ="tag_list ">
13
+ {% for tag in post.tags %}
14
+ < li class ="inline archive_list "> < a class ="tag_list_link " href ="/tag/{{ tag }} "> {{ tag }}</ a > </ li >
15
+ {% endfor %}
16
+ </ ul >
17
+ </ li >
18
+ {% endif %}
19
+ {% endfor %}
20
+ {% endfor %}
21
+ </ ul >
Original file line number Diff line number Diff line change
1
+ module Jekyll
2
+ class TagIndex < Page
3
+ def initialize ( site , base , dir , tag )
4
+ @site = site
5
+ @base = base
6
+ @dir = dir
7
+ @name = 'index.html'
8
+ self . process ( @name )
9
+ self . read_yaml ( File . join ( base , '_layouts' ) , 'tag_index.html' )
10
+ self . data [ 'tag' ] = tag
11
+ tag_title_prefix = site . config [ 'tag_title_prefix' ] || 'Posts Tagged “'
12
+ tag_title_suffix = site . config [ 'tag_title_suffix' ] || '”'
13
+ self . data [ 'title' ] = "#{ tag_title_prefix } #{ tag } #{ tag_title_suffix } "
14
+ end
15
+ end
16
+ class TagGenerator < Generator
17
+ safe true
18
+ def generate ( site )
19
+ if site . layouts . key? 'tag_index'
20
+ dir = site . config [ 'tag_dir' ] || 'tag'
21
+ site . tags . keys . each do |tag |
22
+ write_tag_index ( site , File . join ( dir , tag ) , tag )
23
+ end
24
+ end
25
+ end
26
+ def write_tag_index ( site , dir , tag )
27
+ index = TagIndex . new ( site , site . source , dir , tag )
28
+ index . render ( site . layouts , site . site_payload )
29
+ index . write ( site . dest )
30
+ site . pages << index
31
+ end
32
+ end
33
+ end
You can’t perform that action at this time.
0 commit comments