Class: Lifer::URIStrategy::PrettyRoot

Inherits:
Lifer::URIStrategy show all
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

#root

Instance Method Summary collapse

Methods inherited from Lifer::URIStrategy

#initialize

Constructor Details

This class inherits a constructor from Lifer::URIStrategy

Instance Method Details

#output_file(entry) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/lifer/uri_strategy/pretty_root.rb', line 13

def output_file(entry)
  basename = File.basename entry.file,
    Lifer::Utilities.file_extension(entry.file)

  if basename == "index"
    Pathname "index.html"
  else
    Pathname "#{basename}/index.#{file_extension(entry)}"
  end
end