File tree Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,19 @@ def generate(site)
3131
3232 @site . config [ 'jekyll-archives' ] = @config
3333
34- read_archives
35- @site . pages += @archives
34+ read
35+ render
36+ write
37+
38+ @site . keep_files ||= [ ]
39+ @archives . each do |archive |
40+ @site . keep_files << archive . relative_path
41+ end
42+ @site . config [ "archives" ] = @archives
3643 end
3744
3845 # Read archive data from posts
39- def read_archives
46+ def read
4047 tags . each do |tag |
4148 @archives << Archive . new ( @site , tag [ 1 ] , "tag" , tag [ 0 ] )
4249 end
@@ -48,6 +55,21 @@ def read_archives
4855 end
4956 end
5057
58+ # Renders the archives into the layouts
59+ def render
60+ payload = @site . site_payload
61+ @archives . each do |archive |
62+ archive . render ( @site . layouts , payload )
63+ end
64+ end
65+
66+ # Write archives to their destination
67+ def write
68+ @archives . each do |archive |
69+ archive . write ( @site . dest )
70+ end
71+ end
72+
5173 # Construct a Hash of Posts indexed by the specified Post attribute.
5274 #
5375 # post_attr - The String name of the Post attribute.
Original file line number Diff line number Diff line change @@ -93,11 +93,20 @@ def to_liquid(attrs = nil)
9393 #
9494 # Returns the destination file path String.
9595 def destination ( dest )
96+ @dest ||= dest
9697 path = Jekyll . sanitized_path ( dest , URL . unescape_path ( url ) )
9798 path = File . join ( path , "index.html" ) if url =~ /\/ $/
9899 path
99100 end
100101
102+ # Obtain the write path relative to the destination directory
103+ #
104+ # Returns the destination relative path String.
105+ def relative_path
106+ path = Pathname . new ( destination ( @dest ) ) . relative_path_from Pathname . new ( @dest )
107+ path
108+ end
109+
101110 # Returns the object as a debug String.
102111 def inspect
103112 "#<Jekyll:Archive @type=#{ @type . to_s } @name=#{ @name } >"
You can’t perform that action at this time.
0 commit comments