diff --git a/lib/locomotive/liquid/tags/snippet.rb b/lib/locomotive/liquid/tags/snippet.rb index 336905bf..704a6017 100644 --- a/lib/locomotive/liquid/tags/snippet.rb +++ b/lib/locomotive/liquid/tags/snippet.rb @@ -12,11 +12,14 @@ module Locomotive @slug = @template_name.gsub('\'', '') + @context[:snippets] = [] if @context[:snippets].nil? (@context[:snippets] << @slug).uniq! - snippet = @context[:site].snippets.where(:slug => @slug).first + if @context[:site].present? + snippet = @context[:site].snippets.where(:slug => @slug).first - self.refresh(snippet) if snippet + self.refresh(snippet) if snippet + end end def render(context)