Class: Nesta::Page
- Inherits:
-
Object
- Object
- Nesta::Page
- Defined in:
- lib/nesta-plugin-sluggable/init.rb
Instance Method Summary collapse
Instance Method Details
#best_path?(path) ⇒ Boolean
33 34 35 |
# File 'lib/nesta-plugin-sluggable/init.rb', line 33 def best_path?(path) path == permalink end |
#permalink ⇒ Object
46 47 48 49 50 51 |
# File 'lib/nesta-plugin-sluggable/init.rb', line 46 def permalink p = self.abspath p += '/' + self.slug if self.slug p end |
#slug ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/nesta-plugin-sluggable/init.rb', line 37 def slug return nil unless File.basename(self.filename, File.extname(self.filename)).match(Plugin::Sluggable::SLUGGED_FORMAT) s = self.('slug') s = self.heading.to_s.downcase.gsub(/[^a-z1-9]+/, '-').chomp('-') if s.nil? s end |