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