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

Merge branch 'slugify-mode' into 'rails'

Slugify mode

See merge request sutty/sutty!93
This commit is contained in:
fauno 2023-03-23 22:13:57 +00:00
commit c9eed6c60c
2 changed files with 10 additions and 2 deletions

View file

@ -25,7 +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
title ? Jekyll::Utils.slugify(title) : SecureRandom.uuid
title ? Jekyll::Utils.slugify(title, mode: site.slugify_mode) : SecureRandom.uuid
end
def value
@ -39,6 +39,6 @@ class MetadataSlug < MetadataTemplate
return if post.title&.private?
return if post.title&.value&.blank?
post.title&.value&.to_s
post.title&.value&.to_s&.unicode_normalize
end
end

View 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