5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 12:41:41 +00:00

Merge branch 'issue-14946' into 'rails'

Issue 14946

See merge request sutty/sutty!236
This commit is contained in:
fauno 2024-03-05 19:38:33 +00:00
commit 2c35ffe502

View file

@ -6,7 +6,7 @@ class MetadataPath < MetadataTemplate
#
# @return [String]
def default_value
File.join(site.path, "_#{lang}", "#{date}-#{slug}#{ext}")
File.join(site.path, "_#{lang}", "#{limited_name}#{ext}")
end
# La ruta del archivo según Jekyll
@ -46,4 +46,12 @@ class MetadataPath < MetadataTemplate
def date
post.date.value.strftime('%F')
end
# Limita el nombre de archivo a 255 bytes, de forma que siempre
# podemos guardarlo
#
# @return [String]
def limited_name
"#{date}-#{slug}".mb_chars.limit(255 - ext.length)
end
end