module Middleman::CoreExtensions::DefaultHelpers::Helpers

def page_classes

Returns:
  • (String) -
def page_classes
  path = current_path.dup
  path << index_file if path.match(%r{/$})
  path = path.gsub(%r{^/}, '')
  classes = []
  parts = path.split('.')[0].split('/')
  parts.each_with_index { |path, i| classes << parts.first(i+1).join('_') }
  classes.join(' ')
end