5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 20:26:22 +00:00

feat: poder pasar la ruta a Post.build

This commit is contained in:
f 2023-10-26 18:08:14 -03:00
parent 9531a2004c
commit b0c21f989e
No known key found for this signature in database

View file

@ -38,19 +38,22 @@ class Post
# Genera un Post nuevo
#
# @todo Mergear en Post#initialize
# @params :path [String]
# @params :site [Site]
# @params :locale [String, Symbol]
# @params :document [Jekyll::Document]
# @params :layout [String,Symbol]
# @return [Post]
def build(**args)
args[:path] ||= ''
args[:document] ||=
begin
site = args[:site]
collection = site.collections[args[:locale].to_s]
Jekyll::Document.new('', site: site.jekyll, collection: collection).tap do |doc|
doc.data['date'] = Date.today.to_time
Jekyll::Document.new(args[:path], site: site.jekyll, collection: collection).tap do |doc|
doc.data['date'] ||= Date.today.to_time
end
end