parent
266a8bb746
commit
ea8ac3a7fa
|
@ -92,6 +92,7 @@ module Jekyll
|
|||
self.pages = []
|
||||
self.static_files = []
|
||||
self.data = {}
|
||||
@post_attr_hash = {}
|
||||
@site_data = nil
|
||||
@collections = nil
|
||||
@docs_to_write = nil
|
||||
|
@ -232,6 +233,7 @@ module Jekyll
|
|||
def post_attr_hash(post_attr)
|
||||
# Build a hash map based on the specified post attribute ( post attr =>
|
||||
# array of posts ) then sort each array in reverse order.
|
||||
@post_attr_hash[post_attr] ||= begin
|
||||
hash = Hash.new { |h, key| h[key] = [] }
|
||||
posts.docs.each do |p|
|
||||
p.data[post_attr]&.each { |t| hash[t] << p }
|
||||
|
@ -239,6 +241,7 @@ module Jekyll
|
|||
hash.each_value { |posts| posts.sort!.reverse! }
|
||||
hash
|
||||
end
|
||||
end
|
||||
|
||||
def tags
|
||||
post_attr_hash("tags")
|
||||
|
|
Loading…
Reference in New Issue