Class: Lifer::URIStrategy::PrettyRoot
- Inherits:
-
Lifer::URIStrategy
- Object
- Lifer::URIStrategy
- Lifer::URIStrategy::PrettyRoot
- Defined in:
- lib/lifer/uri_strategy/pretty_root.rb
Overview
This URI strategy follows the “pretty” strategy of indexifying all entries (i.e. ‘entry.md` outputs to `entry/index.html`) and ensuring that, no matter what collection the entry is in, the entry is output to the root of the Lifer build directory. For example:
subdir/entry.md ---> entry/index.html
Instance Attribute Summary
Attributes inherited from Lifer::URIStrategy
Instance Method Summary collapse
Methods inherited from Lifer::URIStrategy
Constructor Details
This class inherits a constructor from Lifer::URIStrategy
Instance Method Details
#output_file(entry) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/lifer/uri_strategy/pretty_root.rb', line 13 def output_file(entry) if basename(entry) == "index" "index.html" else "#{basename entry}#{pretty_part entry}" end end |
#permalink(entry) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/lifer/uri_strategy/pretty_root.rb', line 22 def permalink(entry) if basename(entry) == "index" "/" else output_file(entry).gsub pretty_part(entry), "" end end |