Assign sets a variable in your template.
{% assign foo = 'monkey' %}
You can then use the variable later in the page.
{{ foo }}
# File lib/liquid/tags/assign.rb, line 14 def initialize(tag_name, markup, options) super if markup =~ Syntax @to = $1 @from = Variable.new($2,options) @from.line_number = line_number else raise SyntaxError.new options[:locale].t("errors.syntax.assign".freeze) end end
# File lib/liquid/tags/assign.rb, line 32 def blank? true end
# File lib/liquid/tags/assign.rb, line 25 def render(context) val = @from.render(context) context.scopes.last[@to] = val context.increment_used_resources(:assign_score_current, val) ''.freeze end