use the slug of a content entry as its id

did committed May 13, 2015
commit c2079debb2bba765084a04d91928e632145a2ce8
Showing 1 changed file with 5 additions and 2 deletions
locomotive/wagon/liquid/drops/base.rb b/lib/locomotive/wagon/liquid/drops/base.rb +5 -2
@@ @@ -12,7 +12,10 @@ module Locomotive
end
def id
- (@_source.respond_to?(:id) ? @_source.id : nil) || 'new'
+ (@_source.respond_to?(:id) ? @_source.id : nil) ||
+ (@_source.respond_to?(:slug) ? @_source.slug : nil) ||
+ (@_source.respond_to?(:_slug) ? @_source._slug : nil) ||
+ 'new'
end
# converts an array of records to an array of liquid drops
@@ @@ -43,4 +46,4 @@ module Locomotive
end
end
end
- end
\ No newline at end of file
+ end