mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 20:26:22 +00:00
Merge branch 'slugify-mode' into 'rails'
Slugify mode See merge request sutty/sutty!93
This commit is contained in:
commit
c9eed6c60c
2 changed files with 10 additions and 2 deletions
|
@ -25,7 +25,7 @@ require 'jekyll/utils'
|
||||||
class MetadataSlug < MetadataTemplate
|
class MetadataSlug < MetadataTemplate
|
||||||
# Trae el slug desde el título si existe o una string al azar
|
# Trae el slug desde el título si existe o una string al azar
|
||||||
def default_value
|
def default_value
|
||||||
title ? Jekyll::Utils.slugify(title) : SecureRandom.uuid
|
title ? Jekyll::Utils.slugify(title, mode: site.slugify_mode) : SecureRandom.uuid
|
||||||
end
|
end
|
||||||
|
|
||||||
def value
|
def value
|
||||||
|
@ -39,6 +39,6 @@ class MetadataSlug < MetadataTemplate
|
||||||
return if post.title&.private?
|
return if post.title&.private?
|
||||||
return if post.title&.value&.blank?
|
return if post.title&.value&.blank?
|
||||||
|
|
||||||
post.title&.value&.to_s
|
post.title&.value&.to_s&.unicode_normalize
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
8
db/migrate/20220428135113_add_slugify_mode_to_sites.rb
Normal file
8
db/migrate/20220428135113_add_slugify_mode_to_sites.rb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Permite a los sitios elegir el método de slugificación
|
||||||
|
class AddSlugifyModeToSites < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
add_column :sites, :slugify_mode, :string, default: 'default'
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue