mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 02:01:42 +00:00
36 lines
575 B
Ruby
36 lines
575 B
Ruby
|
# Este campo representa el archivo donde se almacenan los datos
|
||
|
class MetadataPath < MetadataTemplate
|
||
|
# :label en este caso es el idioma/colección
|
||
|
def default_value
|
||
|
File.join(site.path, "_#{lang}", "#{date}-#{slug}#{ext}")
|
||
|
end
|
||
|
|
||
|
def value
|
||
|
default_value
|
||
|
end
|
||
|
alias absolute value
|
||
|
alias to_s value
|
||
|
|
||
|
def relative
|
||
|
value.sub(site.path, '').sub(%r{^/}, '')
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def ext
|
||
|
document.extname || '.markdown'
|
||
|
end
|
||
|
|
||
|
def lang
|
||
|
post.lang
|
||
|
end
|
||
|
|
||
|
def slug
|
||
|
post.slug.value
|
||
|
end
|
||
|
|
||
|
def date
|
||
|
post.date.value.strftime('%F')
|
||
|
end
|
||
|
end
|