lib/middleman-sculptor/helpers/resources.rb in middleman-sculptor-0.10 vs lib/middleman-sculptor/helpers/resources.rb in middleman-sculptor-0.11

- old
+ new

@@ -43,11 +43,11 @@ .reject { |r| r[:parent] != '/' } # Remove non-root directories from the root end def main_sections resources_for('/').select do |r| - r if r.metadata.locals[:name] + r if r.parent.url == '/' end end def local_data(path) current_path = current_resource.path @@ -129,9 +129,16 @@ if r.parent data[:parent] = r.parent.url end end + dir = File.dirname(r.path) + r.add_metadata(locals: { + section: { + title: dir.upcase, + slug: dir.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '-') + } + }) options[:data_fields].each do |field| data[field] = r.data[field] if field == :title && !r.data.title data[field] = resource_dir(r).upcase