From 44a7c33f9f9ad0f35b9222e9f4546abb9152e7d2 Mon Sep 17 00:00:00 2001 From: did Date: Sat, 12 Feb 2011 15:32:35 +0100 Subject: [PATCH] preserve positions of the index and 404 page --- lib/locomotive/import/pages.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/locomotive/import/pages.rb b/lib/locomotive/import/pages.rb index 5830e62f..a41fb0df 100644 --- a/lib/locomotive/import/pages.rb +++ b/lib/locomotive/import/pages.rb @@ -57,6 +57,10 @@ module Locomotive :published => true }.merge(self.pages[fullpath] || {}).symbolize_keys + if %w(index 404).include?(fullpath) + attributes[:position] = fullpath == 'index' ? 0 : 1 + end + # templatized ? if content_type_slug = attributes.delete(:content_type) attributes.merge!({ @@ -142,9 +146,9 @@ module Locomotive position = nil fullpath = data.keys.first.to_s - if %w(index 404).include?(fullpath) - position = fullpath == 'index' ? 0 : 1 - else + unless %w(index 404).include?(fullpath) + # position = fullpath == 'index' ? 0 : 1 + # else (segments = fullpath.split('/')).pop position_key = segments.empty? ? 'index' : segments.join('/')