diff --git a/app/models/article.rb b/app/models/article.rb index 737eb84..338a0db 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -18,4 +18,12 @@ class Article < Comatose::Page @profile ||= Profile.find_by_identifier(self.full_path.split(/\//).first) end + def title=(value) + super + # taken from comatose, added a call to transliterate right before downcase. + if (self[:slug].nil? or self[:slug].empty?) and !self[:title].nil? + self[:slug] = self[:title].transliterate.downcase.gsub( /[^-a-z0-9~\s\.:;+=_]/, '').gsub(/[\s\.:;=_+]+/, '-').gsub(/[\-]{2,}/, '-').to_s + end + end + end -- libgit2 0.21.2