@@ -25,10 +25,11 @@ class Archive
2525 # type - The type of archive. Can be one of "year", "month", "day", "category", or "tag"
2626 # posts - The array of posts that belong in this archive.
2727 def initialize ( site , title , type , posts )
28- @site = site
29- @posts = posts
30- @type = type
31- @title = title
28+ @site = site
29+ @posts = posts
30+ @type = type
31+ @title = title
32+ @config = site . config [ 'jekyll-archives' ]
3233
3334 # Generate slug if tag or category (taken from jekyll/jekyll/features/support/env.rb)
3435 if title . is_a? String
@@ -41,7 +42,7 @@ def initialize(site, title, type, posts)
4142 @name = File . basename ( relative_path , @ext )
4243
4344 @data = {
44- "layout" => site . config [ 'jekyll-archives' ] [ ' layout' ]
45+ "layout" => layout
4546 }
4647 @content = ""
4748 end
@@ -50,7 +51,18 @@ def initialize(site, title, type, posts)
5051 #
5152 # Returns the template String.
5253 def template
53- site . config [ 'jekyll-archives' ] [ 'permalinks' ] [ type ]
54+ @config [ 'permalinks' ] [ type ]
55+ end
56+
57+ # The layout to use for rendering
58+ #
59+ # Returns the layout as a String
60+ def layout
61+ if @config [ 'layouts' ] && @config [ 'layouts' ] [ type ]
62+ @config [ 'layouts' ] [ type ]
63+ else
64+ @config [ 'layout' ]
65+ end
5466 end
5567
5668 # Returns a hash of URL placeholder names (as symbols) mapping to the
@@ -136,7 +148,7 @@ def relative_path
136148
137149 # Returns the object as a debug String.
138150 def inspect
139- "#<Jekyll:Archive @type=#{ @type . to_s } @title=#{ @title } >"
151+ "#<Jekyll:Archive @type=#{ @type . to_s } @title=#{ @title } @data= #{ @data . inspect } >"
140152 end
141153
142154 # Returns the Boolean of whether this Page is HTML or not.
0 commit comments