mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 19:36:21 +00:00
simplificar MetadataSlug
This commit is contained in:
parent
0c6b85c030
commit
6edd9e67a2
1 changed files with 5 additions and 6 deletions
|
@ -25,11 +25,7 @@ require 'jekyll/utils'
|
|||
class MetadataSlug < MetadataTemplate
|
||||
# Trae el slug desde el título si existe o una string al azar
|
||||
def default_value
|
||||
if title
|
||||
Jekyll::Utils.slugify(title)
|
||||
else
|
||||
SecureRandom.hex
|
||||
end
|
||||
title ? Jekyll::Utils.slugify(title) : SecureRandom.uuid
|
||||
end
|
||||
|
||||
def value
|
||||
|
@ -40,6 +36,9 @@ class MetadataSlug < MetadataTemplate
|
|||
|
||||
# Devuelve el título a menos que sea privado y no esté vacío
|
||||
def title
|
||||
post.title&.value&.to_s unless post.title.private? && !post.title&.value&.blank?
|
||||
return if post.title&.private?
|
||||
return if post.title&.value&.blank?
|
||||
|
||||
post.title&.value&.to_s
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue