Minor performance fix to not double-compute metadata in directory_indexes.
This commit is contained in:
parent
044b49d83b
commit
14a39e5e87
|
@ -36,15 +36,15 @@ Feature: link_to helper
|
||||||
And a file named "source/link_to.html.erb" with:
|
And a file named "source/link_to.html.erb" with:
|
||||||
"""
|
"""
|
||||||
<% menu_items.each do |item| %>
|
<% menu_items.each do |item| %>
|
||||||
<%= link_to(item.metadata[:page]['title'], item.url) %>
|
<%= link_to(item.data['title'], item.url) %>
|
||||||
<%= link_to(item.metadata[:page]['title'], item) %>
|
<%= link_to(item.data['title'], item) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
"""
|
"""
|
||||||
And a file named "source/link_to/sub.html.erb" with:
|
And a file named "source/link_to/sub.html.erb" with:
|
||||||
"""
|
"""
|
||||||
<% menu_items.each do |item| %>
|
<% menu_items.each do |item| %>
|
||||||
<%= link_to(item.metadata[:page]['title'], item.url) %>
|
<%= link_to(item.data['title'], item.url) %>
|
||||||
<%= link_to(item.metadata[:page]['title'], item) %>
|
<%= link_to(item.data['title'], item) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
"""
|
"""
|
||||||
And the Server is running at "indexable-app"
|
And the Server is running at "indexable-app"
|
||||||
|
|
|
@ -40,13 +40,10 @@ module Middleman
|
||||||
File.extname(index_file) != resource.ext
|
File.extname(index_file) != resource.ext
|
||||||
|
|
||||||
# Check if frontmatter turns directory_index off
|
# Check if frontmatter turns directory_index off
|
||||||
d = resource.raw_data
|
next if resource.data[:directory_index] == false
|
||||||
next if d && d[:directory_index] == false
|
|
||||||
|
|
||||||
# Check if file metadata (options set by "page" in config.rb) turns directory_index off
|
# Check if file metadata (options set by "page" in config.rb) turns directory_index off
|
||||||
if resource.metadata[:options] && resource.metadata[:options][:directory_index] == false
|
next if resource.metadata[:options][:directory_index] == false
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
resource.destination_path = resource.destination_path.chomp(File.extname(index_file)) + new_index_path
|
resource.destination_path = resource.destination_path.chomp(File.extname(index_file)) + new_index_path
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue