Module: Machined::Helpers::PageHelpers
- Included in:
- Context
- Defined in:
- lib/machined/helpers/page_helpers.rb
Instance Method Summary collapse
-
#layout ⇒ Object
Returns the default layout, unless overridden by the YAML front matter.
-
#title ⇒ Object
Returns the local variable, title, if set.
-
#url ⇒ Object
Returns the URL to this asset, appending the sprocket’s URL.
Instance Method Details
#layout ⇒ Object
Returns the default layout, unless overridden by the YAML front matter.
8 9 10 11 12 13 14 |
# File 'lib/machined/helpers/page_helpers.rb', line 8 def layout if has_local? :layout locals[:layout] else machined.config.layout end end |
#title ⇒ Object
Returns the local variable, title, if set. Otherwise return a titleized version of the filename.
18 19 20 21 22 23 24 |
# File 'lib/machined/helpers/page_helpers.rb', line 18 def title if has_local? :title locals[:title] else File.basename(logical_path).titleize end end |
#url ⇒ Object
Returns the URL to this asset, appending the sprocket’s URL. For HTML files, this will return pretty URLs.
28 29 30 |
# File 'lib/machined/helpers/page_helpers.rb', line 28 def url File.join(environment.config.url, @logical_path).sub /(index)?\.html?$/, '' end |