mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 08:36:21 +00:00
feat: poder pasar la ruta a Post.build
(cherry picked from commit b0c21f989e
)
This commit is contained in:
parent
c07eb97735
commit
bbcfc701b4
1 changed files with 5 additions and 2 deletions
|
@ -38,19 +38,22 @@ class Post
|
||||||
|
|
||||||
# Genera un Post nuevo
|
# Genera un Post nuevo
|
||||||
#
|
#
|
||||||
|
# @todo Mergear en Post#initialize
|
||||||
|
# @params :path [String]
|
||||||
# @params :site [Site]
|
# @params :site [Site]
|
||||||
# @params :locale [String, Symbol]
|
# @params :locale [String, Symbol]
|
||||||
# @params :document [Jekyll::Document]
|
# @params :document [Jekyll::Document]
|
||||||
# @params :layout [String,Symbol]
|
# @params :layout [String,Symbol]
|
||||||
# @return [Post]
|
# @return [Post]
|
||||||
def build(**args)
|
def build(**args)
|
||||||
|
args[:path] ||= ''
|
||||||
args[:document] ||=
|
args[:document] ||=
|
||||||
begin
|
begin
|
||||||
site = args[:site]
|
site = args[:site]
|
||||||
collection = site.collections[args[:locale].to_s]
|
collection = site.collections[args[:locale].to_s]
|
||||||
|
|
||||||
Jekyll::Document.new('', site: site.jekyll, collection: collection).tap do |doc|
|
Jekyll::Document.new(args[:path], site: site.jekyll, collection: collection).tap do |doc|
|
||||||
doc.data['date'] = Date.today.to_time
|
doc.data['date'] ||= Date.today.to_time
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue